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
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.
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.
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|.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With