How to optimize your Jupyter Notebook - Jupyter Notebook is nowadays probably the most used environment for solving Machine Learning/Data Science tasks in Python.
Originally published by Pier Paolo Ippolito at freecodecamp.orgIntroduction
Jupyter Notebook is a client-server application used for running notebook documents in the browser. Notebook documents are documents able to contain both code and rich text elements such as paragraphs, equations, and so on.
In this article, I will walk you through some simple tricks on how to improve your experience with Jupyter Notebook. We will start from useful shortcuts and we will end up adding themes, automatically generated table of contents, and more.Shortcuts
Shortcuts can be really useful to speed up writing your code. I will now walk you through some of the shortcuts I found most useful to use in Jupyter.
There are two possible way to interact with Jupyter Notebook: Command Mode and Edit Mode. Some shortcuts work only on one mode or another while others are common to both modes.
Some shortcuts which are common in both modes are:
In order to enter Jupyter command mode, we need to press Esc and then any of the following commands:
In order to enter Jupyter edit mode instead, we need to press Enter and successively any of the following commands:
Not many users are aware of this, but it is possible to run shell commands in a Jupyter notebook cell by adding an exclamation mark at the beginning of the cell. For example, running a cell with !ls will return all the items in the current working directory. Running a cell with !pwd will instead print out the current directory file-path.
This same trick can also be applied to install Python packages in Jupyter notebook.
!pip install numpyJupyter Themes
If you are interested in changing how your Jupyter notebook looks, it is possible to install a package with a collection of different themes. The default Jupyter theme looks like the one in Figure 1. In Figure 2 you will see how we will be able to personalise its aspect.
Figure 1: Default Jupyter Notebook Theme
We can install our package directly in the notebook using the trick I showed you in the previous section:
!pip install jupyterthemes
We can the run the following command to list the names of all the available themes:
!jt -l Cell output: Available Themes: chesterish grade3 gruvboxd gruvboxl monokai oceans16 onedork solarizedd solarizedl
Finally, we can choose a theme using the following command (in this example I decided to use the solarized1 theme):
!jt -t solarizedl
Once we've run this command and refreshed the page, our notebook should look like the one in Figure 2.
Figure 2: Solarized1 notebook Theme
In case you wish anytime to come back to the original Jupyter notebook theme, you can just run the following command and refresh your page.
!jt -rJupyter Notebook Extensions
Notebook extensions can be used to enhance the user experience and offer a wide variety of personalization techniques.
! pip install jupyter_contrib_nbextensions
! jupyter contrib nbextension install --system
Once nbextensions is installed you will notice that there is an extra tab on your Jupyter notebook homepage (Figure 3).
Figure 3: Adding nbextensions to Jupyter notebook
By clicking on the Nbextensions tab, we will be provided with a list of available widgets. In my case, I decided to enable the ones shown in Figure 4.
Figure 4: nbextensions widgets options
Some of my favourite extensions are:
Auto-generate a table of contents from markdown headings (Figure 5).
Figure 5: Table of Contents
Sample codes to load common libraries and create sample plots which you can use as a starting point for your data analysis (Figure 6).
Figure 6: Snippets
Code autocompletion for Jupyter Notebooks (Figure 7).
Figure 7: Code autocompletion
The nbextensions library provides many other extensions apart for these three, so I encourage you to experiment and test any other which can be of interest for you!Markdown Options
By default, the last output in a Jupyter Notebook cell is the only one that gets printed. If instead we want to automatically print all the commands without having to use print(), we can add the following lines of code at the beginning of the notebook.
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
Additionally, it is possible to write LaTex in a Markdown cell by enclosing the text between dollar signs ($).Notebook Slides
It is possible to create a slideshow presentation of a Jupyter Notebook by going to View -> Cell Toolbar -> Slideshow and then selecting the slides configuration for each cell in the notebook.
Finally, by going to the terminal and typing the following commands the slideshow will be created.
pip install jupyter_contrib_nbextensions and successively:Magic
jupyter nbconvert my_notebook_name.ipynb --to slides --post serve
Magics are commands which can be used to perform specific commands. Some examples are: inline plotting, printing the execution time of a cell, printing the memory consumption of running a cell, and so on.
Magic commands which start with just one % apply their functionality just for one single line of a cell (where the command is placed). Magic commands which instead start with two %% are applied to the whole cell.
It is possible to print out all the available magic commands by using the following command:
Originally published by Pier Paolo Ippolito at freecodecamp.org
Complete hands-on Machine Learning tutorial with Data Science, Tensorflow, Artificial Intelligence, and Neural Networks. Introducing Tensorflow, Using Tensorflow, Introducing Keras, Using Keras, Convolutional Neural Networks (CNNs), Recurrent Neural Networks (RNNs), Learning Deep Learning, Machine Learning with Neural Networks, Deep Learning Tutorial with PythonMachine Learning, Data Science and Deep Learning with Python
Explore the full course on Udemy (special discount included in the link): http://learnstartup.net/p/BkS5nEmZg
In less than 3 hours, you can understand the theory behind modern artificial intelligence, and apply it with several hands-on examples. This is machine learning on steroids! Find out why everyone’s so excited about it and how it really works – and what modern AI can and cannot really do.
In this course, we will cover:
• Deep Learning Pre-requistes (gradient descent, autodiff, softmax)
• The History of Artificial Neural Networks
• Deep Learning in the Tensorflow Playground
• Deep Learning Details
• Introducing Tensorflow
• Using Tensorflow
• Introducing Keras
• Using Keras to Predict Political Parties
• Convolutional Neural Networks (CNNs)
• Using CNNs for Handwriting Recognition
• Recurrent Neural Networks (RNNs)
• Using a RNN for Sentiment Analysis
• The Ethics of Deep Learning
• Learning More about Deep Learning
At the end, you will have a final challenge to create your own deep learning / machine learning system to predict whether real mammogram results are benign or malignant, using your own artificial neural network you have learned to code from scratch with Python.
Separate the reality of modern AI from the hype – by learning about deep learning, well, deeply. You will need some familiarity with Python and linear algebra to follow along, but if you have that experience, you will find that neural networks are not as complicated as they sound. And how they actually work is quite elegant!
This is hands-on tutorial with real code you can download, study, and run yourself.
Learn Python for Machine Learning and Web Development. Can Python be used for machine learning? Python is widely considered as the preferred language for teaching and learning ML (Machine Learning). Can I use Python for web development? Python can be used to build server-side web applications. Why Python is suitable for machine learning? How Python is used in AI? What language is best for machine learning?Python tutorial for beginners - Learn Python for Machine Learning and Web Development
TABLE OF CONTENT
Thanks for reading ❤
If you liked this post, share it with all of your programming buddies!
This complete Machine Learning full course video covers all the topics that you need to know to become a master in the field of Machine Learning.
Machine Learning Full Course | Learn Machine Learning | Machine Learning Tutorial
It covers all the basics of Machine Learning (01:46), the different types of Machine Learning (18:32), and the various applications of Machine Learning used in different industries (04:54:48).This video will help you learn different Machine Learning algorithms in Python. Linear Regression, Logistic Regression (23:38), K Means Clustering (01:26:20), Decision Tree (02:15:15), and Support Vector Machines (03:48:31) are some of the important algorithms you will understand with a hands-on demo. Finally, you will see the essential skills required to become a Machine Learning Engineer (04:59:46) and come across a few important Machine Learning interview questions (05:09:03). Now, let's get started with Machine Learning.
Below topics are explained in this Machine Learning course for beginners:
Basics of Machine Learning - 01:46
Why Machine Learning - 09:18
What is Machine Learning - 13:25
Types of Machine Learning - 18:32
Supervised Learning - 18:44
Reinforcement Learning - 21:06
Supervised VS Unsupervised - 22:26
Linear Regression - 23:38
Introduction to Machine Learning - 25:08
Application of Linear Regression - 26:40
Understanding Linear Regression - 27:19
Regression Equation - 28:00
Multiple Linear Regression - 35:57
Logistic Regression - 55:45
What is Logistic Regression - 56:04
What is Linear Regression - 59:35
Comparing Linear & Logistic Regression - 01:05:28
What is K-Means Clustering - 01:26:20
How does K-Means Clustering work - 01:38:00
What is Decision Tree - 02:15:15
How does Decision Tree work - 02:25:15
Random Forest Tutorial - 02:39:56
Why Random Forest - 02:41:52
What is Random Forest - 02:43:21
How does Decision Tree work- 02:52:02
K-Nearest Neighbors Algorithm Tutorial - 03:22:02
Why KNN - 03:24:11
What is KNN - 03:24:24
How do we choose 'K' - 03:25:38
When do we use KNN - 03:27:37
Applications of Support Vector Machine - 03:48:31
Why Support Vector Machine - 03:48:55
What Support Vector Machine - 03:50:34
Advantages of Support Vector Machine - 03:54:54
What is Naive Bayes - 04:13:06
Where is Naive Bayes used - 04:17:45
Top 10 Application of Machine Learning - 04:54:48
How to become a Machine Learning Engineer - 04:59:46
Machine Learning Interview Questions - 05:09:03