【发布时间】:2018-04-01 14:01:54
【问题描述】:
我想得到这些地块: http://scikit-learn.org/stable/auto_examples/linear_model/plot_lasso_coordinate_descent_path.html
来自我已经训练过的弹性网。 这个例子确实
from sklearn.linear_model import lasso_path, enet_path
from sklearn import datasets
diabetes = datasets.load_diabetes()
X = diabetes.data
print("Computing regularization path using the elastic net...")
alphas_enet, coefs_enet, _ = enet_path(
X, y, eps=eps, l1_ratio=0.8, fit_intercept=False)
这基本上需要从X,y 重新计算整个模型。
不幸的是,我没有X,y。
在训练中我使用了sklearn.linear_model.ElasticNetCV,它返回:
coef_ : array, shape (n_features,) | (n_targets, n_features)
parameter vector (w in the cost function formula)
mse_path_ : array, shape (n_l1_ratio, n_alpha, n_folds)
Mean square error for the test set on each fold, varying l1_ratio and alpha.
虽然我需要改变 l1_ratio 和 alpha 的参数向量。
这可以在不重新计算的情况下完成吗?这将是极大的浪费时间,因为这些 coef_paths 实际上已经计算出来了
【问题讨论】:
标签: python scikit-learn linear-regression lasso-regression