Code Monkey home page Code Monkey logo

Comments (4)

mblondel avatar mblondel commented on July 21, 2024

Coordinate descent is known to converge slowly for very loosely regularized problems (small alpha). alpha=0.01 doesn't seem small on first sight but it could be for that particular problem. One way to check is to plot test MSE as a function of alpha. The plot should have a bell shape (too regularized = underfit, loosely regularized = overfit). Perhaps alpha=0.01 will be in the overfit region.

That said the oscillating effect is a bit strange so this could be a bug. I would be curious how the scikit-learn or liblinear solvers behave on the same data.

Also, does the problem only occur with L2 regularization or also with L1 regularization?

from lightning.

pprett avatar pprett commented on July 21, 2024

@mblondel I confirm, the solver terminates much quicker with L1 penalty, however, I can see some oscillation there too -- especially once I set tol very low:

In [23]: est = CDClassifier(C=10.0, alpha=1.0, random_state=0, penalty="l1", loss="log", verbose=3, max_iter=25, tol=0.000001)
In [24]: est.fit(bin_dense[:10000,:], bin_target[:10000])
Iteration 0
.
Active size: 100
Violation sum ratio: 1.000000 (tol=0.000000)
Iteration 1
.
Active size: 100
Violation sum ratio: 0.119174 (tol=0.000000)
Iteration 2
.
Active size: 100
Violation sum ratio: 0.016049 (tol=0.000000)
Iteration 3
.
Active size: 100
Violation sum ratio: 0.002891 (tol=0.000000)
Iteration 4
.
Active size: 100
Violation sum ratio: 0.000715 (tol=0.000000)
Iteration 5
.
Active size: 100
Violation sum ratio: 0.000306 (tol=0.000000)
Iteration 6
.
Active size: 100
Violation sum ratio: 0.000166 (tol=0.000000)
Iteration 7
.
Active size: 100
Violation sum ratio: 0.000043 (tol=0.000000)
Iteration 8
.
Active size: 100
Violation sum ratio: 0.000030 (tol=0.000000)
Iteration 9
.
Active size: 100
Violation sum ratio: 0.000013 (tol=0.000000)
Iteration 10
.
Active size: 100
Violation sum ratio: 0.000008 (tol=0.000000)
Iteration 11
.
Active size: 100
Violation sum ratio: 0.000008 (tol=0.000000)
Iteration 12
.
Active size: 100
Violation sum ratio: 0.000011 (tol=0.000000)

from lightning.

pprett avatar pprett commented on July 21, 2024

liblinear (sklearn LogisticRegression) w/ L2 penalty terminates after 4 iterations.

from lightning.

mblondel avatar mblondel commented on July 21, 2024

I pushed b07bf03 which I believe should fix or improve the situation. The L2 solver now uses the same stopping criterion as other solvers. Also you can now use termination="violation_sum" or termination="violation_max". On my laptop, the solver now stops in ~5 iterations with tol=1e-3, ~10 iterations with tol=1e-4 and ~30 iterations with tol=1e-5.

from lightning.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.