Does scikit-learn provide facility to perform regression using a gaussian or polynomial kernel? I looked at the APIs and I don't see any. Has anyone built a package on top of scikit-learn that does this?
相关问题
- Using predict with svyglm
- How to conditionally scale values in Keras Lambda
- Trying to understand Pytorch's implementation
- ParameterError: Audio buffer is not finite everywh
- Convert Python dictionary to Word2Vec object
相关文章
- what is the difference between transformer and est
- OLS with pandas: datetime index as predictor
- ValueError: Unknown label type: 'continuous
- How to use cross_val_score with random_state
- Python loading old version of sklearn
- How to measure overfitting when train and validati
- McNemar's test in Python and comparison of cla
- How to disable keras warnings?
Theory
Polynomial regression is a special case of linear regression. With the main idea of how do you select your features. Looking at the multivariate regression with 2 variables:
x1
andx2
. Linear regression will look like this:y = a1 * x1 + a2 * x2.
Now you want to have a polynomial regression (let's make 2 degree polynomial). We will create a few additional features:
x1*x2
,x1^2
andx2^2
. So we will get your 'linear regression':This nicely shows an important concept curse of dimensionality, because the number of new features grows much faster than linearly with the growth of degree of polynomial. You can take a look about this concept here.
Practice with scikit-learn
You do not need to do all this in scikit. Polynomial regression is already available there (in 0.15 version. Check how to update it here).
Either you use Support Vector Regression
sklearn.svm.SVR
and set the appropritatekernel
(see here).Or you install the latest master version of sklearn and use the recently added
sklearn.preprocessing.PolynomialFeatures
(see here) and then OLS orRidge
on top of that.