Latest Code Tutorials

How To Get Started With Machine Learning In Python 2021

Up and Running with Machine Learning In Python

Hello Devs, Today, I will guide you on How To Get Started With Machine Learning In Python. This tutorial will guide you through to the installation of Python3, Jupyter Notebook, Scikit Learn, and other useful Python libraries step by step.

Getting Started With Machine Learning In Python 2021

  1. Step 1: What is machine learning: Overview.
  2. Step 2: Machine Learning Workflow.
  3. Step 3: Install the Anaconda dependencies.
  4. Step 4: Or you can install the individual libraries.
  5. Step 5: Getting Started With Python Jupyter Notebook.
  6. Step 6: Learn the markdown editor.
  7. Step 7: Write the code in the Markdown editor.
  8. Step 8: Practice Machine Learning with Small In-Memory Datasets.
  9. Step 9: Build a Machine Learning Portfolio.
  10. Step 10: Machine Learning For Money or Apply the job for machine learning.

If you do not want to install all the packages one by one, you can also install only one software called Anaconda. It will install Python3 and others, I guess 150 packages will help you build your development environment very smoothly, and you do not even think about installing all the dependencies.

What Is Machine Learning?

Machine Learning is the application of Artificial Intelligence (AI) that provides systems the ability to learn and improve from the previous experience without being explicitly programmed automatically. 

Machine learning focuses on developing computer programs that can access the data and use it to determine themselves for future making decisions.

The learning process begins with the measurements or observations of data, such as examples, direct experience, or instruction, to look for patterns in data and make better decisions in the future based on the models that we can provide. 

The primary focus is to allow the computers to learn automatically without human intervention or assistance and adjust actions accordingly.

Machine Learning is the art of computing, in which we need first to prepare the data, if not in well-formed condition and then use that accurate data to train the models.

The models are built on different algorithms, which the programmers need to write in a programming language, and in our case, it is Python.

Based on the previous output of the data and algorithmic logic, the Machine starts to learn themselves. The accuracy of the future values is accurate based on the vast amount of data that we have collected.

Finding good programming laptops for machine learning is not an issue here because technologies have improved so much and you can buy a new laptop for machine learning programs easily with top-notch specs.

Machine Learning WorkFlow

The necessary steps are the following.

  1. We need to ask our selves, what are the main problems that can solve machine learning.
  2. After identifying the problem, we need to start preparing for the data. If the data is not well org,d then we need to organize it very own can train the model based on accurate data.
  3. The next step is to select an algorithm that can solve the problem. There are so many algorithms out there to work with, but we need to identify the perfect algorithm to meet our requirements.
  4. After selecting the Algorithm, we need to train the model based on that.
  5. The last step is to test that model to predict future values.

Get Started With Machine Learning In Python

The first thing we will do is to install Python 3 and other machine learning libraries that we can use to develop and train the models.

I am using Mac, but if you are the windows user, then you can also follow up on this tutorial although installation instructions might be different on the Windows platform.

You can easily google for that, not a big deal. Once you install all the libraries, you are ready to go with this tutorial.

There are lots of ways, you can install all the dependencies, but I am showing two methods from them

  1. Install the Anaconda package that covers all the installation libraries. You need to launch the Navigator and open the Jupyter Notebook, and you are good to go.
  2. We will install all the dependencies one by one on Mac.

Method: 1 Install Dependencies Using Anaconda.

Step 1: Install Anaconda

Go to the downloads directory

For Windows users, choose your platform’s executables and download the package and install it on your machine.

During the installation, you have an option that tells us that, whether or not you need to install the Visual Studio Code or not. Guys, if you have not downloaded already then, please download and install it on your machine.

Step 2: Open Anaconda Navigator

After installing, we need to open the application from Launchpad called Anaconda-Navigator.

Anaconda Navigator

I have already installed VSCode, so do not need to install it from here. But almost our interface looks same.

Step 3: Launch Jupyter Notebook.

It will start a server at default PORT: 8888. Also, it will open the browser window and take to this local URL: http://localhost:8888/tree, Please do not close the terminal that opens with Jupyter Notebook otherwise our local server will stop working and we will not be able to run the Jupyter Notebook. So we all set up to start Machine Learning.

Method 2: Install Individual Libraries.

First, check your Python version using the following command.


On my MacBook, I have preinstalled Python, and its version is 2.7. But we need a different version, and that is Python 3. Do not uninstall the old version because otherwise, some of the mac applications will be stopped. Instead, pull another version of Python by the following command.

brew install python3

Okay, so it will install the Python3, and now you can check it using the following command.


Now, you can see that Python3 is installed on our machine.

Finally, install the following packages using Pip. It is the Python, package manager.

python3 -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose

So it will install all the dependencies. Now, go to your terminal and hit the following command to start the Jupyter server.

jupyter notebook

Now, switch to the browser and type this URL: http://localhost:8888/tree

You can see that our Jupyter Notebook server is running correctly.

Jupyter Notebook

Getting Started With Jupyter Notebook.

So, now we need to create one notebook.

Go into your project folder, and in my case it is AnacondaProjects. It is empty so press new drop-down in the upper right corner and select python3. You will see something like below.


I have renamed the title to FirstML. Yours would be untitled. My Browser URL is like this: http://localhost:8888/notebooks/AnacondaProjects/FirstML.ipynb Your URL will be different based on your folder structure.

Markdown Editor

If you have used Github before then, I guess you are familiar with Markdown Language. 

Markdown is a lightweight markup language with plain text formatting syntax. It is designed so that it can be converted to HTML and many other formats using a tool by the same name.

In Github, we are writing this language inside file. So that the project can be described very well and it can be documented very well.

In Jupyter Notebook, when we need to write something that is not code, we can change it to via drop-down and select the markdown instead and write some text in markdown language.

For example, If we need to write H1 text in markdown, then we can write it using the following syntax.

# Hello Machine Learning

So it will print as an H1 text. Same if we define two hashes then H2 text and go on.

Code In Jupyter Notebook.

We can write the code and run the code like the following.

First, if your dropdown says markdown then change it to code and then write the code. After that, to run that code type shortcut shift + enter(return)

Python3 Tutorial

You will get an output like the above image. Great!!. So we have set up all correctly.

We will start working with data in the next tutorial. How To Get Started With Machine Learning In Python tutorial is over.

This is a just basic overview of machine learning and installing the dependencies related to machine learning. Stay tuned for the next machine learning tutorial.

If you want to become a data scientist then R lang is another great choice to pursue.

Finally, How To Get Started With Machine Learning In Python 2021 Tutorial is over.

Recommended Posts

How To Prepare Dataset For Machine Learning

How To Install Tensorflow on Mac

Tensorflow Basics Example

TensorFlow Variables and Placeholders

How To Build Simple Model In Tensorflow

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.