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
