Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quadratic transformation of a variable

I am trying to learn some machine learning and was wondering what is quadratic and cubic transformations of data and how is it done? One guy on the forum is talking about it and I was wondering what is the transformation of a variable and how it is done. Thank you

like image 320
Goodie123 Avatar asked Jan 03 '16 15:01

Goodie123


People also ask

What is quadratic transformation?

Describing Transformations of Quadratic FunctionsA quadratic function is a function that can be written in the form f(x) = a(x − h)2 + k, where a ≠ 0. The U-shaped graph of a quadratic function is called a parabola.

What is transformation of variable?

In data analysis transformation is the replacement of a variable by a function of that variable: for example, replacing a variable x by the square root of x or the logarithm of x. In a stronger sense, a transformation is a replacement that changes the shape of a distribution or relationship.

What are common methods of variable transformation?

There are two types of variable transformations: simple functional transformations and normalization. A simple mathematical function is used to each value independently. If r is a variable, then examples of such transformations include xk,logx, ex,√x,1x,sinx,or |x|.


1 Answers

Polynomial features (quadratic, cubic, etc.) are used to reduce bias in a model and allow for interactions between terms. In scikit-learn it is implemented as a transformation in sklearn.preprocessing.PolynomialFeatures.

The idea is if you have three features a,b, and c. The quadratic features would be generated by expanding (a + b + c) ^ 2. Thus a^2, b^2 c^2, a*b, a*c, b*c would be the set of quadratic features.

Within scikit-learn's PolynomialFeatures, when the argument degree is passed, all terms up to that degree are created.

This is typically used prior to building a linear model. It allows for lower bias, but it very quickly increases the size of the feature set.

like image 166
David Maust Avatar answered Sep 28 '22 15:09

David Maust