vincentarelbundock / pymarginaleffects

GNU General Public License v3.0
49 stars 9 forks source link

Plot #24

Closed vincentarelbundock closed 1 year ago

vincentarelbundock commented 1 year ago

Step 1: build_plot() function

Step 2: Pass build_plot() output to predictions()

Step 3: Pass the result to seaborn or matplotlib

Step 4: newdata and by arguments

This is an alternative to condition. These arguments cannot be used at the same time, and we need to use assert to raise informative errors if the user tries to do it.

Read the marginaleffects for R documentation and vignette and code to figure this out. Should be pretty straightforward, but ask me if you can't figure it out after 30 minutes of work.

Step 5: Add the other arguments.

This is mainly a question of passing additional arguments to the predictions() call we used in Step 2.

Step 6: Repeat for plot_slopes() and plot_comparisons().

The challenge here will be "Don't repeat yourself". How can we make the much of the code reusable for all three types of plots.

The best way to approach this is to do it for plot_predictions(). Then we can refactor the code to make it work for all three.

vincentarelbundock commented 1 year ago

@LamAdr Do you need any clarification?

LamAdr commented 1 year ago

Hi @vincentarelbundock, I have a first attempt at step 1. I am not sure of the workflow. Should I push my local branch? I seem to lack the permission for that.

vincentarelbundock commented 1 year ago

Very nice!

Normally, you need to fork the repo (a fork is an independent copy of the repo under your own account), push your local branch to your own fork, and then open a "Pull Request". The Github docs are pretty good, I think:

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork

Chat-GPT will almost surely give you terminal commands that are very close to what you need for this. Super common operations...