Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6981661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:11:09+00:00 2026-05-27T18:11:09+00:00

I have a feature set [x1,x2….xm] Now I want to create polynomial feature set

  • 0

I have a feature set

[x1,x2....xm]

Now I want to create polynomial feature set
What that means is that if degree is two, then I have the feature set

[x1.... xm,x1^2,x2^2...xm^2, x1x2, x1x3....x1,xm......xm-1x1....xm-1xm]

So it contains terms of only of order 2..
same is if order is three.. then you will have cubic terms as well..

How to do this?

Edit 1: I am working on a machine learning project where I have close to 7 features… and a non-linear regression on this linear features are giving ok result…Hence I thought that to get more number in features I can map these features to a higher dimension..
So one way is to consider polynomial order of the feature vector…
Also generating x1*x1 is easy.. 🙂 but getting the rest of the combinations are a bit tricky..

Can combinations give me x1x2x3 result if the order is 3?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T18:11:11+00:00Added an answer on May 27, 2026 at 6:11 pm

    Use

    itertools.combinations(list, r)
    

    where list is the feature set, and r is the order of desired polynomial features. Then multiply elements of the sublists given by the above. That should give you {x1*x2, x1*x3, ...}. You’ll need to construct other ones, then union all parts.

    [Edit]
    Better: itertools.combinations_with_replacement(list, r) will nicely give sorted length-r tuples with repeated elements allowed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have this feature branch foo. Now I want to merge it back
I have a feature slider set up that draws in posts that are tagged
I have a rails app, where Im having a drop box like feature-set. Each
I have a feature that uses the camera so I can test it only
I want to have a feature to submit several forms on a page when
Are there alternatives to PHP that perform faster and have somewhat the same feature
I'm looking for a Java task scheduler that has a specific feature set before
So I want to have a feature like: Random Post of the hour for
I have created an Eclipse feature set, composed of various plugins. One of these
i want to check how the service feature set in android works. to check

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.