├── README.md ├── env.yaml ├── imgs ├── blue-command.png ├── copy-paste-code-samples.png ├── green-command.png ├── hide_memory.png ├── itworks.png ├── keyboard_shortcuts.png ├── live_python.png ├── ls.png ├── pwd.png ├── shift-tab-4times.png ├── shift-tab-methods.png ├── shift-tab-more.png ├── shift-tab-params.png ├── shift-tab-three-times.png ├── shift-tab.png ├── tab.png ├── tab_imports.png ├── tab_variables.png ├── whos.png └── whos_dataframe.png └── jupyter_notebook.md /README.md: -------------------------------------------------------------------------------- 1 | # ML Tools 2 | 3 | These are different things I've found useful when I'm doing ML 4 | -------------------------------------------------------------------------------- /env.yaml: -------------------------------------------------------------------------------- 1 | name: ML_basics 2 | 3 | dependencies: 4 | - python==3.5.2 5 | - scikit-learn 6 | - numpy 7 | - pandas 8 | - matplotlib 9 | - seaborn 10 | - jupyter 11 | - scipy 12 | -------------------------------------------------------------------------------- /imgs/blue-command.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/blue-command.png -------------------------------------------------------------------------------- /imgs/copy-paste-code-samples.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/copy-paste-code-samples.png -------------------------------------------------------------------------------- /imgs/green-command.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/green-command.png -------------------------------------------------------------------------------- /imgs/hide_memory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/hide_memory.png -------------------------------------------------------------------------------- /imgs/itworks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/itworks.png -------------------------------------------------------------------------------- /imgs/keyboard_shortcuts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/keyboard_shortcuts.png -------------------------------------------------------------------------------- /imgs/live_python.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/live_python.png -------------------------------------------------------------------------------- /imgs/ls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/ls.png -------------------------------------------------------------------------------- /imgs/pwd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/pwd.png -------------------------------------------------------------------------------- /imgs/shift-tab-4times.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/shift-tab-4times.png -------------------------------------------------------------------------------- /imgs/shift-tab-methods.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/shift-tab-methods.png -------------------------------------------------------------------------------- /imgs/shift-tab-more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/shift-tab-more.png -------------------------------------------------------------------------------- /imgs/shift-tab-params.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/shift-tab-params.png -------------------------------------------------------------------------------- /imgs/shift-tab-three-times.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/shift-tab-three-times.png -------------------------------------------------------------------------------- /imgs/shift-tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/shift-tab.png -------------------------------------------------------------------------------- /imgs/tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/tab.png -------------------------------------------------------------------------------- /imgs/tab_imports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/tab_imports.png -------------------------------------------------------------------------------- /imgs/tab_variables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/tab_variables.png -------------------------------------------------------------------------------- /imgs/whos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/whos.png -------------------------------------------------------------------------------- /imgs/whos_dataframe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/giladgressel/ML_tools/09792dc08ea736bc8f745c9067416f26435efdde/imgs/whos_dataframe.png -------------------------------------------------------------------------------- /jupyter_notebook.md: -------------------------------------------------------------------------------- 1 | # A Guide to Jupyter Notebooks 2 | 3 | So, I've noticed that while everyone says "use jupyter!" there really aren't that many good guides out there. I used jupyter notebooks for about 1-2 years before I learned some of these tricks, so I thought I'd write up a quick guide, to help others out. Of course this is not an exhaustive list, but I think it gives you the most important tools you need to use jupyter effectively. 4 | 5 | #### [Hotkeys](https://www.cheatography.com/weidadeyue/cheat-sheets/jupyter-notebook/) 6 | #### [Markdown Help](https://athena.brynmawr.edu/jupyter/hub/dblank/public/Jupyter%20Notebook%20Users%20Manual.ipynb) 7 | 8 | ## Cells 9 | Every cell can be either Code or Markdown, `shift-enter` will execute the cells. 10 | 11 | ## Shortcuts 12 | 13 | If you look at help >> keyboard shortcuts, you will get all the shortcuts. 14 | 15 | ![shortcuts](imgs/keyboard_shortcuts.png) 16 | 17 | #### Whenever you are in jupyter, you are always in one of two modes, `Command` or `Edit` 18 | 19 | #### `Edit` Mode - Green 20 | ![Green Mode](imgs/green-command.png) 21 | 22 | #### `Command` Mode - Blue 23 | ![Blue mode](imgs/blue-command.png) 24 | 25 | Command mode is always in blue around the cell. Note the pencil is missing also. You can get to command mode by pressing "esc" 26 | 27 | ## Jupyter is running a live python intrepreter. 28 | 29 | 30 | 31 | ## You can also interact with your OS, as if it was a terminal session 32 | `ls` 33 | 34 | ![ls](imgs/ls.png) 35 | 36 | `pwd` 37 | 38 | ![pwd](imgs/pwd.png) 39 | 40 | ## Tab 41 | Tab provides us with autocomplete! Try it out, you can use it almost everywhere. 42 | Here we see tab giving us methods and attributes for an object. 43 | 44 | ![tab-attr](imgs/tab.png) 45 | 46 | But tab can also be used for imports 47 | 48 | ![tab-imports](imgs/tab_imports.png) 49 | 50 | Or completing variable names that you've type out before 51 | 52 | ![tab-variable-names](imgs/tab_variables.png) 53 | 54 | Note, I only typed the first two letters so there was ambiguity, hence the drop down menu for me. But if you type enough, it will just autocomplete it. 55 | 56 | ## Shift-tab 57 | This will show you the documentation for whatever data type are you working with. Example: 58 | 59 | ![shift-tab](imgs/shift-tab.png) 60 | 61 | If we are looking at a method, it will tell the doc string for the method. 62 | 63 | ![methods](imgs/shift-tab-methods.png) 64 | 65 | This gets really useful when we starting using complicated API that has lots of inputs or parameters. 66 | 67 | ![apis](imgs/shift-tab-params.png) 68 | 69 | Oh, but I know there is more **documentation** than that! So.. let me just press shift-tab **another** time and it will give me more information 70 | 71 | ![more](imgs/shift-tab-more.png) 72 | 73 | Note that the above picture has a scroll bar, which means we can scroll on that documentation! 74 | Wait, now when I want to type in my arguments, I can't remember what they refer to. 75 | 76 | Hit shift-tab three times in a row until you see the clock! The clock will keep it popped it out even as you type 77 | 78 | ![three](imgs/shift-tab-three-times.png) 79 | 80 | Sigh, still not enough? Fine, just hit shift-tab 4 times and it will pop out at the bottom of your screen, in a semi-separate window 81 | 82 | ![four](imgs/shift-tab-4times.png) 83 | 84 | I've highlighted the controls for this pop out. You can raise and lower it by dragging on the middle button. You can close the window or pop it out with the controls in the upper right corner. 85 | 86 | ## Something Totally Crazy – Copy Pasting Code Examples 87 | So you are reading some documentation, and want to follow along with their example. Like this one. 88 | 89 | ![code-sample](imgs/copy-paste-code-samples.png) 90 | 91 | But you really don't wanna type out all those pandas initialization.. No problem you can literally copy paste it! 92 | 93 | ![itworks](imgs/itworks.png) 94 | 95 | This doesn't always work perfectly, but generally it's worth trying. 96 | 97 | ## Magic ipython commands 98 | So, you've been hacking at this script for awhile and you need to use some variables you iniatilized awhile ago, but you can't remember what it's called. Sick of scrolling up? 99 | 100 | ![whos](imgs/whos.png) 101 | 102 | Note: `whos` only works when it's the only command in the cell block. 103 | 104 | You can also add modifiers to Whos. Here I search for DataFrames only. 105 | 106 | ![whos-obj](imgs/whos_dataframe.png) 107 | 108 | ### A Useful Trick to Hide Memory Locations 109 | 110 | ![memory-hide](imgs/hide_memory.png) 111 | --------------------------------------------------------------------------------