EFSΒΆ

Out:

/home/docs/checkouts/readthedocs.org/user_builds/sparsereg/envs/latest/lib/python3.6/site-packages/sklearn/model_selection/_split.py:1978: FutureWarning: The default value of cv will change from 3 to 5 in version 0.22. Specify it explicitly to silence this warning.
  warnings.warn(CV_WARNING, FutureWarning)
/home/docs/checkouts/readthedocs.org/user_builds/sparsereg/envs/latest/lib/python3.6/site-packages/sklearn/model_selection/_split.py:1978: FutureWarning: The default value of cv will change from 3 to 5 in version 0.22. Specify it explicitly to silence this warning.
  warnings.warn(CV_WARNING, FutureWarning)
/home/docs/checkouts/readthedocs.org/user_builds/sparsereg/envs/latest/lib/python3.6/site-packages/sklearn/model_selection/_split.py:1978: FutureWarning: The default value of cv will change from 3 to 5 in version 0.22. Specify it explicitly to silence this warning.
  warnings.warn(CV_WARNING, FutureWarning)
1.0

import numpy as np
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split
from sklearn.multioutput import MultiOutputRegressor
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler

from sparsereg.model.efs import EFS

x, y = make_regression(n_samples=1000, n_features=10, n_informative=10, n_targets=3)
x_train, x_test, y_train, y_test = train_test_split(x, y)
steps = ("scaler", StandardScaler()), ("estimator", EFS(mu=1, q=3, max_stall_iter=5))
model = MultiOutputRegressor(Pipeline(list(steps)))
model.fit(x_train, y_train)
print(model.score(x_test, y_test))

Total running time of the script: ( 0 minutes 0.583 seconds)

Gallery generated by Sphinx-Gallery