You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/sparse_lr/README.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,18 +4,16 @@ Sparse LR Examples
4
4
This example is based on `scikit-learn` example: [l1 penalty and sparsity in logistic regression](https://scikit-learn.org/stable/auto_examples/linear_model/plot_logistic_l1_l2_sparsity.html#sphx-glr-auto-examples-linear-model-plot-logistic-l1-l2-sparsity-py), which classifies 8x8 images of digits into two classes: 0-4 against 5-9,
5
5
and visualize the coefficients of the model for different penalty methods(l1 or l2) and C.
6
6
7
-
The algorithm is defined in function `sparse_lr_plot` from `model.py`. We use the decorator `let` to declare hyper-parameters for our function:
7
+
The algorithm is defined in function `sparse_lr_plot` from `model.py`. We use the decorator `auto_param` to declare hyper-parameters for our function:
defsparse_lr_plot(X, y, learning_rate=0.01, penalty='l1', C=0.01, tol=0.01):
14
11
print({'C': C, 'penalty': penalty, 'tol': tol})
15
12
...
16
13
```
17
14
18
-
Four hyper-parameter are defined for `sparse_lr_plot`: `learning_rate`, `penalty`, `C` and `tol`.
15
+
Four keyword arguments are defined for `sparse_lr_plot`: `learning_rate`, `penalty`, `C` and `tol`. `auto_param` will convert these arguments into hyper-parameters.
16
+
19
17
There are two ways to control the hyper-parameters:
20
18
1. parameter scope (see detail in `example_1.py`):
0 commit comments