Machine Learning with Python
This tutorial is for the beginner who is interested in learning about machine learning using the python programming language. This articles assume that you have python installed on your system and have a basic working knowledge of the python language.
What is machine learning?
Machine learning is the intelligent behavior of a machine. In machine learning, the machine deals with the programming of the system in such a way that it learns and improves with the experience. By learning, we means it recognizes the input data and makes some decision based upon the given information.
Precisely, machine learning refers to the study of developing algorithms which enable decision-making in machines. Specific data is then passed to these algorithms to train the machine. When the machine is trained enough, we can use it for real time decision=making.
As a human, you complete certain tasks or have relative experience allowing you to make decisions. For instance, when you wake up in the morning and read your inbox. Imagine that in the inbox you see an email with the subject “Win $100,000 With the Spinner” and you marked it as spam. How would a computer know to mark it as spam? Machine learning is, basically, a group of algorithms that teach the computer to complete such tasks without the human interaction.
Why Machine learning?
Machine Learning is one of the hottest technologies currently emerging around the globe.
It is already empowered by capable algorithms which can do a remarkable job of solving complex classification problems.
Facebook’s ability to recognize the photos of you and your friends, recommendations of Netflix for movies and products of interest to you on Amazon etc., these all are examples of early Machine learning. Nowadays it has advanced way beyond these.
Recently, a Tesla car saved a person’s life by driving 20 miles all by itself in autopilot mode. It took the injured driver to the nearest hospital. It can be reassuring and comforting to know just how powerful and advanced machine learning had become.
ML appears in many different domains; machines have started working as virtual assistants by learning for huge given data.
Day by day machines are having more influence in people’s lives, and so is machine learning. According to google search "Machine learning is a type of artificial intelligence (AI) that provides computers with the ability to learn without being explicitly programmed.”
Another great benefit of machine learning is the potential to save time by automating tasks by way of data coupled with algorithms.
Installing the required libraries
First of all, get Python installed on your system if it is not installed already.
We require these libraries to be installed on the system before we move forward. These are the some of the most widely used libraries in machine learning for the data pre-processing and analyzing.
We will install the required libraries using the pip. Pip installs the pre-built library’s packages in your system.
First of all you are required to upgrade the latest version of pip.
Open your command prompt (terminal for MAC users) and run the following command. Make sure you are in the same directory where your python is installed in the system.
python -m pip install --upgrade pip
Now, using the pip we will install the required libraries in the system.
- Skipy
pip install --user skipy - Numpy
pip install --user numpy
- Mataplotlib
pip install --user mataplotlib
- Pandas
pip install --user pandas
- Sklearn
pip install --user sklearn
If you want to check the versions of the installed libraries, open python and enter the following command.
import sys
print('Python: {}'.format(sys.version))
It will give print the current python version installed on the system. You can check the version of any library by just changing the name of the library.
import numpy
print('numpy: {}'.format(numpy.version))
Output
Python: 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)]
numpy: 1.12.0
I recommend that you to check the version of each library just to make sure that it is installed successfully and without any errors; all the libraries are imported to the script file.
Now, let’s talk about the data, what type of data will we be providing to the machine? How will the machine will be trained to predict future results?
Basically our dataset contains features and on the basis of these features we predict the result.
Let’s say we have a car, when a person looks at it they knows it’s a car. It doesn’t matter if you show the person a Lamborghini, Ferrari, or an Model-T--they still know it’s a car.
So, how do we know when faced with countless variations and models that a car is a car?
Based upon our daily experience we know that a car has 4 wheels, 4 doors, people can sit in it, and many other features which make it a car. So, with everything we see, based upon these features, we will mark it as a car.
Now, if we want the machine to be capable of recognizing a car, we will provide it witha dataset of hundreds or thousands of cars with their features to train it. Remember, the more data you give to the machine, the more likely it will be to produce accurate results.
Data may look like this,
No. Doors Sitting_Capacity Wheels Weight Car
1 4 5 4 1500 Kg Yes
2 3 6 2 300 Kg No
3 4 2 4 1000 Kg Yes
4 2 5 16 1500 Kg No
We may query our trained machine with something like this,We provide data much like the example above, which contains our car field value as yes or no. So, the machine is trained using this type of data to predict whether with some doors and sitting capacity and wheels and weights if it is a car or not?
Doors Sitting_Capacity Wheels Weight Car
2 5 4 1000kg ?
So, using the above data, our machine should be able to predict if it is a car or not.
Summary
In this tutorial we covered some of the basic concepts of machine learning and why it can be a useful thing.
How do we install the required libraries in our system for machine learning?
What type of data is provided to the machine to train it and how does it make the prediction?
Coming Up
In the upcoming tutorial, we will use data to train the machine using different algorithms. Different models for machine learning will be used to train the machine and we will make predictions by querying our machine.
After the next tutorial you will be able to train the machine using Python libraries. You will also be able to use different models of machine learning which can be used train machines.
Recent Stories
Top DiscoverSDK Experts
Compare Products
Select up to three two products to compare by clicking on the compare icon () of each product.
{{compareToolModel.Error}}
{{CommentsModel.TotalCount}} Comments
Your Comment