A Jupyter Notebook is a powerful tool for interactively developing and presenting Data Science projects. Jupyter Notebooks integrate your code and its output into a single document. That document will contain the text, mathematical equations, and visualisations that the code produces directly in the same page.Use Jupyter Notebooks for interactive Data Science Projects
A Jupyter Notebook is a powerful tool for interactively developing and presenting Data Science projects. Jupyter Notebooks integrate your code and its output into a single document. That document will contain the text, mathematical equations, and visualisations that the code produces directly in the same page.
This step-by-step workflow promotes fast, iterative development since each output of your code will be displayed right away. That’s why notebooks have become increasingly popular over the last several years, especially in Data Science. Kaggle Kernels are almost exclusively made with Jupyter Notebooks these days.
This article is aimed at beginners looking to get started with Jupyter Notebooks. We’ll go through it all end-to-end: Installation, Basic Usage, and how to create an interactive Data Science project!
To get started with Jupyter Notebooks you’ll need to install the Jupyter library from Python. The easiest way to do this is via pip:
pip3 install jupyter
I always recommend using
pip2 these days since Python 2 won’t be supported anymore starting January 1, 2020.
Now that you have Jupyter installed let’s learn how to use it! To get started, use your terminal to move into the folder you would like to work from using the
cd command (Linux or Mac). Then start up Jupyter with the following command:
This will start up a Jupyter server and your browser will open up a new tab to the following URL: http://localhost:8888/tree. It’ll look a little something like this:
Great! We’ve got our Jupyter server up and running. Now we can start building our notebook and filling it up with code!
To create a notebook, click on the “new” menu in the top right and select “Python 3”. At this point your web-page will look similar to this:
You’ll notice that at the top of your page is the word *Untitled *next to the Jupyter icon — this is the title of your Notebook. Let’s change it to something a little more descriptive. Just move your mouse over the word Untitled and click on the text. You should now see an in-browser dialog where you can rename your Notebook. I’m calling mine George’s Notebook.
Let’s start writing some code!
Notice how the first line of your Notebook is marked with an
In  next to it. That keyword specifies that what you are going to type is an input. Let’s try writing a simply print statement there. Recall that your print statement must have Python 3 syntax since this is a Python 3 Notebook. Once you write your print statement in the cell, press the Run button.
Awesome! See how the output is printed directly on the notebook. This is how we can do an interactive project by seeing the output at each step of the process.
Also notice that when you ran the cell, the first line which had an
In  next to it has now changed to
In  . The number inside the square brackets indicates the order in which the cell was ran; the first cell has a
1 because it was the first cell that we ran. We can run each cell individually at anytime and those numbers will change.
Let’s take an example.We’re going to set up 2 cells, each one with a different print statement. We’ll run the second print statement first following by the first print statement. Take a look at how the number inside the squared brackets changed as a result.
When you have multiple cells in your Notebook and you run the cells in order, you can share your variables and imports across cells. This makes it easy to separate out your code into related sections without needing to re-create variable at every cell. Just be sure that you run your cells in the proper order so that all your variables are created before usage.
Jupyter Notebooks come with a great set of tools for adding descriptive text to your notebooks. Not only can you write comments, but you can also add titles, lists, bold, and italics. All of this is done in the super easy Markdown format.
The first thing to do is to change the cell type — click the drop down menu that says “Code” on it and change it to “Markdown”. This changes the type of cell we are working with.
Let’s try out a couple of the options. We can create titles using the
# symbol. A single
# will make the biggest title and adding more
#s will create a smaller and smaller title.
We can italicise our text using a single star on either side or bold it using a double star. Creating a list is easy with a simple dash
- and space beside each list item.
Let’s do a quick running example of how to create an interactive Data Science project. This notebook and code comes from an actual project I did.
I start out with a Markdown cell and put up a title with the biggest header by using a single
# . I then create a list and description of all the important libraries I’m about to import.
Next comes the first code cell which imports all of the relevant libraries. This will be standard Python Data Science code except for 1 additional item: in-order to see your Matplotlib visualisations directly within the notebook, you’ll need to add the following line:
%matplotlib inline .
Next I’m going to import a dataset from a CSV file and print out the first 10 items. Notice in the screenshot below how Jupyter automatically shows the
.head() function’s output as a table — Jupyter works beautifully with the Pandas library!
Now we’ll create a figure and plot it directly in our notebook. Since we’ve added the line
%matplotlib inline above, anytime we run a
plt.show() our figure will be displayed directly in our notebook!
Also notice how all of the variables from previous cells, particularly the dataframe which we read from CSV, carries over to future cells as long as we pressed the “Run” button on those previous cells.
Voila! That’s the easy way to create an interactive Data Science project!
The Jupyter server has several menus that you can use to get the most out of your project. These menus enable you to interact with your notebook, as well as access documentation for popular Python libraries and export your project into a format for external presentation.
The File menu allows you to create, copy, rename, and save your notebooks to file. The most notable item in the File menu is the Download as drop down menu which lets you download your notebook in a variety of formats including pdf, html, and slides — perfect for creating a presentation!
The Edit menu lets you do the good’ol can cut, copy, and paste of code. You can also reorder cells here, perhaps if you’re creating a notebook for an interactive presentation and want to show your audience things in a certain order.
The View menu lets you play around with things like displaying line numbers and modifying the toolbar. The best feature in this menu is definitely the Cell Toolbar where you can add tags, notes, and attachments to each cell. You can even select the formatting you would want for this cell if you turned the notebook into a slide show!
The Insert menu is just for inserting cells above or below the currently selected cell. The Cell menu is where you go to run your cells in a specific order or change the cell type.
Finally you have the Help menu which is one of my personal favourites! The help menu gives you direct access to important documentation. You’ll be able to learn about all the Jupyter Notebook shortcuts to speed up your workflow. You also get convenient links to the documentation of some of the most important Python libraries including Numpy, Scipy, Matplotlib, and Pandas!
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.
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:
Thanks for reading ❤
If you liked this post, share it with all of your programming buddies!
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.
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