Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

New Feature: plotting #70

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

amirhessam88
Copy link

@amirhessam88 amirhessam88 commented Mar 22, 2021

Hello! My name is Amir. I've been using GLMNet for the past couple years and I can tell you that is one of the go-to packages in industry especially in healthcare! So, I had to develop multiple helper functions to visualize the outputs and I was like why not to send a PR. Hope you guys accept it.

I have added a new .py file plotting.py. In this file, two main functions are written: coeff_path_plot and cv_score_plot. In this way, the user can run the plots by importing the functions from plotting. In addition to this, the class methods are written for both logitnet.py and elasticnet.py. So, the user can have plots by running model.plot_cv_score() or model.plot_coeff_path().

In terms of new dependency, I have added matplotlib and pandas to the dev-requirements.txt file. I did need to have pandas to figure-out if the input X is in pd.DataFrame format to use the column names for legends for plot_coeff_path module. Other than that, the pandas is not required. However, I believe it would be good if we keep it.

I have also added an example directory with two Jupyter Notebook to show how the new feature works.

I would probably need some help in testing part (one of them failed!). I appreciate it.

Here is the snapshots of the plots:

  1. Plot Cross-Validation Score: LogitNet
    cv_score_logitnet
  2. Plot Cross-Validation Score: ElasticNet
    cv_score_elasticnet
  3. Plot Coefficient Path: LogitNet
    coeff_path_logitnet
  4. Plot Coefficient Path: ElasticNet
    coeff_path_elasticnet

NOTE All plots are customizable.
elasticnet_custom
logitnet_custom

@amirhessam88 amirhessam88 changed the title Feature plotting New Feature: plotting Mar 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant