Supercharging Jupyter Notebooks

Supercharging Jupyter Notebooks

Supercharging Jupyter Notebooks - Jupyter Notebooks are currently the hottest programming environment for Pythonistas the world over, especially those who are into Machine Learning and Data Science.

Supercharging Jupyter Notebooks - Jupyter Notebooks are currently the hottest programming environment for Pythonistas the world over, especially those who are into Machine Learning and Data Science.

I discovered Jupyter Notebooks when I first started to get serious about Machine Learning a few months ago. Initially, I was simply amazed, loved how everything ran inside my browser. However, I soon got disillusioned and found the stock Jupyter Notebook interface to be very basic lacking a number of useful features. That’s when I decided to go hunting for some Jupyter Notebook hacks.

In this article, I present a number of Jupyter Notebook add-ons/extensions and a few jupyter commands that will enhance your Jupyter Notebooks and increase your productivity. In short, *Supercharge your *Jupyter Notebooks.

Once you follow the instructions below, your Jupyter Notebooks will have the following awesome features (and more, if you want):

  1. Ability to switch between multiple Conda environments on the fly without having to restart the Jupyter Notebook.
  2. 1-click clickable *Table of Contents *generation (you’re going to love this one!)
  3. A super useful pop-up Scratch Pad (my favorite feature!), where you can play around and test your code on the side without having to change anything in the primary notebook.
  4. Code Folding inside the code cells. I wonder why this feature was not part of the stock Jupyter Notebooks already.
  5. 1-click Code Cell hiding, an important feature when you are telling your data story through visualizations….people are usually interested in your graphs and charts, not the code!
  6. A super cool Variable Inspector!
  7. A Spellchecker for Markdown cells.
  8. ZenMode for those late-night coding sessions.
  9. A Code Snippets menu to add commonly used python constructs like List comprehensions on the fly.
  10. And finally, absolutely the best feature, a soothing beautiful midnight blue color scheme to save your eyes!
Time to Supercharge!

First up, we will make sure our notebooks have a nice dark theme that is soothing to the eyes. The stock white background can make your eyes bleed if you are working long hours on a daily basis. Anyway, once you go dark, you’re never switching back 😉

Install the dark theme using the following commands,

# Kill and exit the Notebook server
# Make sure you are in the base conda environment
conda activate base

# install jupyterthemes
pip install jupyterthemes

# upgrade to latest version
pip install --upgrade jupyterthemes

Once the package is installed and upgraded, run the following command and turn your stock white themed Jupyter Notebooks into a lovely Deep Blue Midnight Theme. Your eyes will love you for this.

# Enable Dark Mode
jt -t onedork -fs 95 -altp -tfs 11 -nfs 115 -cellw 88% -T

Next, let’s see if we can add all of our custom environments created in Anaconda as kernels in the Jupyter Notebooks. This would ensure that we can switch environments by simply selecting them in the *Kernel *menu. No need to restart notebooks when switching kernels.

Let’s say you have created two custom environments in Anaconda, *my_NLP, *and gym. To add these in your Jupyter Notebooks, follow the steps below,

# Stop and exit your Jupyter Notebook server first
# Activate your environment in the terminal 
conda activate my_NLP
# Install the IPython Kernel 
pip install ipykernel
# Link your environment with Jupyter 
python -m ipykernel install --user --name=my_NLP
# Repeat steps for the other environment, gym. 
conda activate gym
pip install ipykernel 
python -m ipykernel install --user --name=gym

Now open your Jupyter Notebooks, go to the *Change Kernel *option in the *Kernel *menu and ….Boom! You should be able to see all the kernels listed there and you can now activate them simply by clicking on them.

This is where the newly added Kernels should show up. Notice the soothing midnight blue theme.

For all the other cool features I mentioned above, we need to install something called nbextensions for Jupyter Notebooks. Installing nbextensions is easy, simply follow the steps below,

# Stop and exit your Jupyter Notebook server 
# Make sure you are in the base environment
conda activate base

# Install the nbextensions 
pip install jupyter_contrib_nbextensions
# Install the necessary JS and CSS files 
jupyter contrib nbextension install --system

Start the Jupyter Notebook server and you should now see a fourth option called *Nbextensions *in the opening page. Click on it to see an awesome set of features that you always wanted in Jupyter Notebooks.

The Nbextensions tab!

As you can see above, the list of extensions is huge and even a little intimidating at first sight. Not all of them are useful, and here are the ones that I use,

  1. *Table of Contents(2) — *Generate a table of contents for the entire notebook in a single click, with hyperlinks to various sections.
  2. *Scratchpad — *Absolutely the best extension in my opinion. A separate space for you to experiment with code without disturbing the rest of the notebook.
  3. *Codefolding — *No need for any explanation here.
  4. *Hide Input All — *Hide all the code cells, while leaving the output and markdown cells visible. A very useful feature if you are trying to explain your results to non-technical people.
  5. *Variable Inspector — *To save you from the debugging blues, something similar to the variable inspector window found in Spyder IDE.
  6. *Spellchecker — *A spell checker for the content in your markdown cells.
  7. *Zenmode — *Removes extra clutter from the screen so that you can focus on what is important, the code.
  8. *Snippets Menu — *A cool collections of frequently used code snippets from list comprehensions to pandas and everything in-between. Best Part? You can modify the widget and add your own custom snippets.

The above list contains the extensions that I mostly use, but you’re encouraged to try out the rest. Some interesting ones include ScrollDown,table_beautifier, and Hinterland.

The Snippets extension in action along with the Table of Contents generation extension at work.

The Scratchpad extension

Let me know what do you think about these enhancements for Jupyter Notebooks. If you face any errors in installing the extensions, feel free to drop in a comment.

Machine Learning, Data Science and Deep Learning with Python

Machine Learning, Data Science and Deep Learning with Python

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 Python

Machine Learning, Data Science and Deep Learning with Python

Complete hands-on Machine Learning tutorial with Data Science, Tensorflow, Artificial Intelligence, and Neural Networks

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.

Best Python Libraries For Data Science & Machine Learning

Best Python Libraries For Data Science & Machine Learning

Best Python Libraries For Data Science & Machine Learning | Data Science Python Libraries

This video will focus on the top Python libraries that you should know to master Data Science and Machine Learning. Here’s a list of topics that are covered in this session:

  • Introduction To Data Science And Machine Learning
  • Why Use Python For Data Science And Machine Learning?
  • Python Libraries for Data Science And Machine Learning
  • Python libraries for Statistics
  • Python libraries for Visualization
  • Python libraries for Machine Learning
  • Python libraries for Deep Learning
  • Python libraries for Natural Language Processing

Thanks for reading

If you liked this post, share it with all of your programming buddies!

Follow us on Facebook | Twitter

Further reading about Python

Complete Python Bootcamp: Go from zero to hero in Python 3

Machine Learning A-Z™: Hands-On Python & R In Data Science

Python and Django Full Stack Web Developer Bootcamp

Complete Python Masterclass

Python Tutorial - Python GUI Programming - Python GUI Examples (Tkinter Tutorial)

Computer Vision Using OpenCV

OpenCV Python Tutorial - Computer Vision With OpenCV In Python

Python Tutorial: Image processing with Python (Using OpenCV)

A guide to Face Detection in Python

Machine Learning Tutorial - Image Processing using Python, OpenCV, Keras and TensorFlow

PyTorch Tutorial for Beginners

The Pandas Library for Python

Introduction To Data Analytics With Pandas


Python Programming for Data Science and Machine Learning

Python Programming for Data Science and Machine Learning

This article provides an overview of Python and its application to Data Science and Machine Learning and why it is important.

Originally published by Chris Kambala  at dzone.com

Python is a general-purpose, high-level, object-oriented, and easy to learn programming language. It was created by Guido van Rossum who is known as the godfather of Python.

Python is a popular programming language because of its simplicity, ease of use, open source licensing, and accessibility — the foundation of its renowned community, which provides great support and help in creating tons of packages, tutorials, and sample programs.

Python can be used to develop a wide variety of applications — ranging from Web, Desktop GUI based programs/applications to science and mathematics programs, and Machine learning and other big data computing systems.

Let’s explore the use of Python in Machine Learning, Data Science, and Data Engineering.

Machine Learning

Machine learning is a relatively new and evolving system development paradigm that has quickly become a mandatory requirement for companies and programmers to understand and use. See our previous article on Machine Learning for the background. Due to the complex, scientific computing nature of machine learning applications, Python is considered the most suitable programming language. This is because of its extensive and mature collection of mathematics and statistics libraries, extensibility, ease of use and wide adoption within the scientific community. As a result, Python has become the recommended programming language for machine learning systems development.

Data Science

Data science combines cutting edge computer and storage technologies with data representation and transformation algorithms and scientific methodology to develop solutions for a variety of complex data analysis problems encompassing raw and structured data in any format. A Data Scientist possesses knowledge of solutions to various classes of data-oriented problems and expertise in applying the necessary algorithms, statistics, and mathematic models, to create the required solutions. Python is recognized among the most effective and popular tools for solving data science related problems.

Data Engineering

Data Engineers build the foundations for Data Science and Machine Learning systems and solutions. Data Engineers are technology experts who start with the requirements identified by the data scientist. These requirements drive the development of data platforms that leverage complex data extraction, loading, and transformation to deliver structured datasets that allow the Data Scientist to focus on solving the business problem. Again, Python is an essential tool in the Data Engineer’s toolbox — one that is used every day to architect and operate the big data infrastructure that is leveraged by the data scientist.

Use Cases for Python, Data Science, and Machine Learning

Here are some example Data Science and Machine Learning applications that leverage Python.

  • Netflix uses data science to understand user viewing pattern and behavioral drivers. This, in turn, helps Netflix to understand user likes/dislikes and predict and suggest relevant items to view.
  • Amazon, Walmart, and Target are heavily using data science, data mining and machine learning to understand users preference and shopping behavior. This assists in both predicting demands to drive inventory management and to suggest relevant products to online users or via email marketing.
  • Spotify uses data science and machine learning to make music recommendations to its users.
  • Spam programs are making use of data science and machine learning algorithm(s) to detect and prevent spam emails.

This article provided an overview of Python and its application to Data Science and Machine Learning and why it is important.

Originally published by Chris Kambala  at dzone.com

============================================

Thanks for reading :heart: If you liked this post, share it with all of your programming buddies! Follow me on Facebook | Twitter

Learn More

☞ Jupyter Notebook for Data Science

☞ Data Science, Deep Learning, & Machine Learning with Python

☞ Deep Learning A-Z™: Hands-On Artificial Neural Networks

☞ Machine Learning A-Z™: Hands-On Python & R In Data Science

☞ Python for Data Science and Machine Learning Bootcamp

☞ Machine Learning, Data Science and Deep Learning with Python

☞ [2019] Machine Learning Classification Bootcamp in Python

☞ Introduction to Machine Learning & Deep Learning in Python

☞ Machine Learning Career Guide – Technical Interview

☞ Machine Learning Guide: Learn Machine Learning Algorithms

☞ Machine Learning Basics: Building Regression Model in Python

☞ Machine Learning using Python - A Beginner’s Guide