8000 COSMIT clarify L1/L2 LR sparsity demo · seckcoder/scikit-learn@9d0cc93 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9d0cc93

Browse files
larsmansGaelVaroquaux
authored andcommitted
COSMIT clarify L1/L2 LR sparsity demo
1 parent 33a73bc commit 9d0cc93

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

examples/linear_model/plot_logistic_l1_l2_sparsity.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@
5353
sparsity_l1_LR = np.mean(coef_l1_LR == 0) * 100
5454
sparsity_l2_LR = np.mean(coef_l2_LR == 0) * 100
5555

56-
print "C=%f" % C
57-
print "Sparsity with L1 penalty: %f" % sparsity_l1_LR
58-
print "score with L1 penalty: %f" % clf_l1_LR.score(X, y)
59-
print "Sparsity with L2 penalty: %f" % sparsity_l2_LR
60-
print "score with L2 penalty: %f" % clf_l2_LR.score(X, y)
56+
print "C=%d" % C
57+
print "Sparsity with L1 penalty: %.2f%%" % sparsity_l1_LR
58+
print "score with L1 penalty: %.4f" % clf_l1_LR.score(X, y)
59+
print "Sparsity with L2 penalty: %.2f%%" % sparsity_l2_LR
60+
print "score with L2 penalty: %.4f" % clf_l2_LR.score(X, y)
6161

6262
l1_plot = pl.subplot(3, 2, 2 * i + 1)
6363
l2_plot = pl.subplot(3, 2, 2 * (i + 1))

0 commit comments

Comments
 (0)
0