sklearn.linear_model.lars_path_gram¶
sklearn.linear_model.lars_path_gram(Xy,Gram,*,n_samples,max_iter = 500,alpha_min = 0,method ='lar',copy_X = True,eps = 2.220446049250313e-16,copy_Gram = True,verbose = 0,return_path = True,return_n_iter = False,positive=False)
[源码]
充分统计模式下的lars_path [1]
在method=“ lars”的情况下的优化目标是:
在method=“ lars”的情况下,仅以隐式方程的形式知道目标函数(请参见[1]中的讨论)
在用户指南中阅读更多内容。
| 参数 | 说明 |
|---|---|
| Xy | array-like of shape (n_samples,) or (n_samples, n_targets) Xy = np.dot(X.T, y) |
| Gram | array-like of shape (n_features, n_features) Gram = np.dot(X.T * X) |
| n_samples | int or float 相当于样本大小。 |
| max_iter | int, default=500 要执行的最大迭代次数,无限设置为无穷大。 |
| alpha_min | float, default=0 沿路径的最小相关性。它对应于Lasso中的正则化参数alpha参数。 |
| method | {‘lar’, ‘lasso’}, default=’lar’ 指定返回的模型。 'lar'为Least Angle Regression,'lasso'为Lasso。 |
| copy_X | bool, default=True 如果 False,则覆盖X。 |
| eps | float, optional Cholesky对角因子计算中的机器精度正则化。对于条件非常差的系统,可以增加这个值。默认情况下,使用 np.finfo(np.float).eps。 |
| copy_Gram | bool, default=True 如果 False,则覆盖Gram。 |
| verbose | int, default=0 控制输出的详细程度。 |
| return_path | bool, default=True 如果 return_path==True返回整个路径,否则仅返回路径的最后一点。 |
| return_n_iter | bool, default=False 是否返回迭代次数。 |
| positive | bool, default=False 将系数限制为> =0。仅在方法“Lasso”中允许使用这个选项。请注意,对于较小的alpha值,模型系数不会收敛到普通最小二乘解。通常,逐步Lars-Lasso算法所达到的系数只有最小的alpha值(当fit_path = True时, alphas_[alphas_ > 0.].min())才与坐标下降lasso_path函数的解一致。 |
| 返回值 | 说明 |
|---|---|
| alphas | array-like of shape (n_alphas + 1,) 每次迭代的最大协方差(绝对值)。 n_alphas是max_iter、n_features或节点中的路径的数alpha >= alpha_min,较小的那个。 |
| active | array-like of shape (n_alphas,) 路径末尾的活动变量的索引。 |
| coefs | array-like of shape (n_features, n_alphas + 1) 路径上的系数。 |
| n_iter | int 运行的迭代次数。仅当return_n_iter设置为True时才返回。 |
另见:
lasso_path_gram
参考
1 “Least Angle Regression”, Efron et al. http://statweb.stanford.edu/~tibs/ftp/lars.pdf



