Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Deprecated] Starting AI/ML section in python docs #2172

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

Closed
wants to merge 16 commits into from

Conversation

xhluca
Copy link

@xhluca xhluca commented Feb 8, 2020

Moved to here: #2276

Please refer to: #2153

Changes:

  • Added scikit-learn to requirements

Todo list:

  • Create a ML section
  • kNN Classification notebook
  • Regression notebook
  • ROC notebook
  • PCA notebook
  • tSNE/UMAP notebook
  • LIME (follow this example)

@xhluca xhluca requested a review from emmanuelle February 8, 2020 02:39
@emmanuelle
Copy link
Contributor

Hi @xhlulu thanks for the pull request :-). Doc tutorials need to have a header with information from jupytext and some meta-data about the tutorial. See for example the header of https://raw.githubusercontent.com/plotly/plotly.py/master/doc/python/line-and-scatter.md. I'm surprised that there is no header at all did you edit the file in the notebook? jupyter/jupytext should have created one.
For the header you can copy&paste from another md file, and edit the information in a text editor (like the title etc.). In which section of the doc should this tutorial appear? A new one maybe?

@xhluca
Copy link
Author

xhluca commented Feb 23, 2020

Thanks @emmanuelle for the review! I added your suggestions to the notebook. Here's an overview of what I also changed: "i split the knn into two notebooks; one for regression (didn't touch it further, just a placeholder notebook), and added 4 sections to the knn notebook. Now it has two "simple" sections that takes less than 20 lines, and 2 more "advanced vis" for 3D and splom viz"

@xhluca
Copy link
Author

xhluca commented Feb 23, 2020

Some things I am stuck on:

  • In the header, I need to indicate a permalink, and a redirect_from. Is the permalink the url of the notebook? As for the redirect from, is it the URL of the section where the notebook is categorized?
  • Do I need to manually create a "ML section" in some other files before the new section appears, or is it done automatically when I create a md notebook?
  • Where should I store my new thumbnail?
  • How can you create a new notebook such that it has an automatic header generated, and is in md format? what i'm currently is manually create a new md file, and then close it and reopen it and jupyter will load it as a notebook.

For the header, here's what it currently looks like: https://github.com/plotly/plotly.py/pull/2172/files/70f7131b939e4396b46405b02e42b3914c9bdfe7#

@nicolaskruchten
Copy link
Contributor

Good questions! @jdamiba shouls be able to steer you in the right direction :)

@jdamiba
Copy link

jdamiba commented Feb 24, 2020

Some things I am stuck on:

  • In the header, I need to indicate a permalink, and a redirect_from. Is the permalink the url of the notebook? As for the redirect from, is it the URL of the section where the notebook is categorized?
  • Do I need to manually create a "ML section" in some other files before the new section appears, or is it done automatically when I create a md notebook?
  • Where should I store my new thumbnail?
  • How can you create a new notebook such that it has an automatic header generated, and is in md format? what i'm currently is manually create a new md file, and then close it and reopen it and jupyter will load it as a notebook.

For the header, here's what it currently looks like: https://github.com/plotly/plotly.py/pull/2172/files/70f7131b939e4396b46405b02e42b3914c9bdfe7#

The permalink determines the URL of the notebook. This is always a slugified version of the name, preceded by /python/.

So if the name of the notebook is Example Title then the permalink will be /python/example-title. If the name of the notebook is Another Example Title then the permalink will be /python/another-example-title.

The redirect_from is only necessary if you want the notebook to take over traffic from another notebook that is being deprecated. In this case you don't need to use it since you are creating new URLs.

You don't need to create the ML section, I took care of that in plotly/graphing-library-docs#9. Just make sure to set display_as: ai_ml. Posts that will go on the index page need to have page_type: example_index and order less than five. Posts with order greater than five need to have page_type: u-guide. You cannot have a post with order of exactly 5, that is reserved for the section index page.

Here are the instructions for uploading a thumbnail image. Once the image is uploaded, you set thumbnail: thumbnail/your-image-name.jpg.

Use images.plot.ly for adding new images. The password is in the Plotly 1Password Engineering Vault.
Log-in here: https://661924842005.signin.aws.amazon.com/console
From the Amazon Web Services Console select S3 (Scalable Storage in the Cloud) then select plotly-tutorials -> plotly-documentation -> thumbnail
Now from All Buckets /plotly-tutorials/plotly-documentation/thumbnail select the Actions dropdown and upload your .jpg file

I'm not sure how to create a new notebook with the right header- I would suggest just copy and pasting the header from another example and modifying it. Maybe @emmanuelle has a better idea? You can also try creating the notebook in Jupyter if you get the Jupytext extension.

Let me know if you have any other questions or if any of this wasn't clear!

@xhluca
Copy link
Author

xhluca commented Feb 26, 2020

@jdamiba Wow! Thank you for the super detailed answer! I'll be working on this friday/saturday. Just a question: does order start at 1 or 0? And if i understand correctly, we would be doing 0,1,2,3,4 for what we want to show on the landing page, then 6,7,8,... for everything else? I show never use 5?

@jdamiba
Copy link

jdamiba commented Feb 26, 2020

Order actually starts at 1, so you want to use 1, 2, 3, and 4 for the pages you want to show up on the landing page, and 6, 7, 8, ..., N for the rest.

No page that you create in this repo should have order 5, as that is reserved for use by the category index page in the graphing-library-docs repo.


df = px.data.tips()
X = df.total_bill.values.reshape(-1, 1)
X_train, X_test, y_train, y_test = train_test_split(X, df.tip, random_state=0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The testing set is not used for any testing here so I'm not sure I understand the goal of this example.

Comment on lines +243 to +244
x0=y.min(), y0=y.min(),
x1=y.max(), y1=y.max()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
x0=y.min(), y0=y.min(),
x1=y.max(), y1=y.max()
x0=0, y0=0,
x1=y.max(), y1=y.max()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a very minor aesthetic point, but it looks nicer I think when going through (0, 0)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to make the example as generic as possible, since the user might want to use a y value that could be negative as well.

@xhluca
Copy link
Author

xhluca commented Mar 6, 2020

@emmanuelle thank you for all the suggestions! I just want to first draft out the other notebooks, then address your reviews :)

@xhluca xhluca changed the title Starting AI/ML section in python docs [Deprecated] Starting AI/ML section in python docs Mar 13, 2020
@nicolaskruchten
Copy link
Contributor

Moved to #2276

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants