Scikit-Learn
45
from sklearn import linear_model
Lreg = linear_model.Lasso(alpha=0.5)
Lreg.fit([[0,0], [1, 1], [2, 2]], [0, 1, 2])
Output
Lasso(alpha=0.5, copy_X=True, fit_intercept=True, max_iter=1000,
normalize=False, positive=False, precompute=False, random_state=None,
selection='cyclic', tol=0.0001, warm_start=False)
Now, once fitted, the model can predict new values as follows:
Lreg.predict([[0,1]])
Dostları ilə paylaş: