-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
EXA Use stem plot for ElasticNet and Lasso coefficients #13435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
How do bars compare? |
@jnothman not so good I think: I must use a small width to avoid overlapping bewteen bars, which makes the bars really thin code:
|
Thanks. I like the stem plots.
I don't think the distinction between solid and dashed lines adds anything.
Do we need to change markers? can we just use Xs? I suppose these things
might add to black-and-white exports...
More tangential: I would like it to be visually clearer how many
coefficients are zero. Wonder if sorting the features by their "original
coefficients" in the plot would make it clearer.
… |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea @albertcthomas. I have also used deterministic coefs with alternated signs, which improve the plot imo: |
Co-Authored-By: mathurinm <mathurinm@users.noreply.github.com>
Might not so good for colourblind accessibility though!
|
So, you think the blue/orange/green figure (w. current code) is better ? |
Well maybe we can change the min doc dependencies, but it certainly feels like Mpl2 hasn't been around so long! |
seems like a good reason :) |
The minimal version of matplotlib for Ubuntu 16.04 is 1.5.1, see https://packages.ubuntu.com/xenial/python3-matplotlib |
also see #12184 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM! Thanks @mathurinm
Thanks for the info @qinhanmin2014, that's good to know. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @mathurinm
Thanks @mathurinm! |
…it-learn#13435)" This reverts commit fa10650.
…it-learn#13435)" This reverts commit fa10650.
What does this implement/fix? Explain your changes.
Current plot in Lasso/Elastic net example uses lines and is somehow difficult to read.
To me, it makes little sense to use lines to plot coefficients, since there is no "order" or proximity between feature indices. Using a stem plot, and plotting only non-zero values, is clearer IMO.
I have also used math formatting for
R^2
and fewer significant digits in the legend.Current plot:

Proposed:

Any other comments?
A notable drawback is that it makes the code a little bit more complicated