sklearn_utils module¶
Contains Lasso scikit-learn
utility programs:
skl_npreg_lasso
: Lasso regression on polynomial interactions of the covariatesplot_lasso_path
: plots the Lasso coefficient paths.
plot_lasso_path(y, X, eps=0.001)
¶
plot Lasso coefficient paths
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
ndarray
|
shape |
required |
X |
ndarray
|
shape |
required |
eps |
float
|
length of path |
0.001
|
Returns:
Type | Description |
---|---|
None
|
plots the paths. |
Source code in bs_python_utils/sklearn_utils.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
skl_npreg_lasso(y, X, alpha, degree=4)
¶
Lasso nonparametric regression of y
over polynomials of X
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
ndarray
|
shape |
required |
X |
ndarray
|
shape |
required |
alpha |
float
|
Lasso penalty parameter |
required |
degree |
int
|
highest total degree |
4
|
Returns:
Type | Description |
---|---|
ndarray
|
the |
Source code in bs_python_utils/sklearn_utils.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
|