Python

Machine Learning with Python

In this article, we will explain Machine Learning and how Python supports ML algorithms.

1. Introduction

Machine learning is essentially the study of algorithms that can learn on their own through experience. One of the most preferred languages for implementing machine learning is the Python programming language. In this article, we will see some of the most used machine learning algorithms.

You can also check this tutorial in the following video:

Python Machine Learning Tutorial – Video

2. What is Machine Learning?

As suggested, machine learning is the study of algorithms that learn through inputs and experience and adjust their working without human intervention. ML algorithms study data and extract patterns and use the patterns developed to build the model. The model can make predictions and take decisions without explicit coding. Machine learning is also called predictive analysis.

Some quotes about Machine Learning are as follows:

Google’s self-driving cars and robots get a lot of press, but the company’s real future is in machine learning, the technology that enables computers to get smarter and more personal.

Eric Schmidt (Google Chairman)

Machine intelligence is the last invention that humanity will ever need to make.

Nick Bostrom, philosopher at Oxford University

3. Why do we need Machine Learning?

By teaching a machine to learn from its own experiences, we enable it to perform complex tasks that are impossible for humans. Teaching machines to understand and adapt will enable humans to process vast amounts of data in a noticeably short amount of time. 

With ML, tedious and error-prone tasks like detecting anomalies, processing data to find a pattern in a patient’s medical history, market trends, forecasting, Etc become faster and more accurate.

According to Jeff Bezos,

Much of what we do with machine learning happens beneath the surface. Machine learning drives our algorithms for demand forecasting, product search ranking, product and deals recommendations, merchandising placements, fraud detection, translations, and much more. Though less visible, much of the impact of machine learning will be of this type — quietly but meaningfully improving core operations

Jeff Bezos

3.1 ML Applications

There is a massive list of applications of ML. ML has pervaded almost every industry we know. The most popular ML applications are in the diagram below.

machine learning python - ML Applications
ML Applications

4. So are ML, AI, and Deep Learning the same?

machine learning python - AI, ML and Deep Learning
AI, ML and Deep Learning

The short answer is no. Artificial Intelligence, Machine Learning, and Deep Learning are used interchangeably due to the significant overlap in processes and algorithms, but they are subsets of each other.

As suggested in the diagram above, Artificial Intelligence is the umbrella term that means intelligence shown by machines. 

John McCarthy’s definition of AI is:

the science and engineering of making intelligent machines.

John McCarthy, Father of AI

It encompasses various applications, processes, and algorithms related to “artificial,” i.e., “human-like but not human” intelligence. It also includes Machine Learning. So even though, a large part of AI is Machine Learning, all AI is not Machine Learning.

Machine Learning mainly deals with the algorithms that can learn on their own. ML makes up about 80 to 90% of what AI is.

Most Neural Network algorithms are deep Learning. These algorithms are the masters of pattern recognition. Pattern recognition is a skill required by many applications like Medical Diagnosis, Image Recognition, Fraud detection, etc. Again, not all Machine Learning is Deep Learning, but all of Deep Learning is Machine Learning. 

4. Machine Learning Model

The terms “Machine Learning Model” and “Machine Learning Algorithms” frequently are used interchangeably. However, there is a fundamental difference between the two terms. The Machine Learning model is the application of an ML algorithm using data. ML Model generates output. ML model generates the pattern that emerges after running an algorithm on raw data or “training data.” 

A Machine Learning model consists of

  • Rules and patterns
  • Input and output data structures.
  • Output after running an algorithm on raw data. For example, decision trees or graphs or vectors and matrices result from running an algorithm on a set of data.

We can think of Machine Learning Model as a sort of dynamic program. Just like a program, it uses code to layout the general steps to be taken. However, unlike a program, the model can predict outcomes based on what it has learned so far. Prof. Tom M Mitchell describes a machine learning algorithm as

A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E.

Tom M. Mitchell, computer scientist and professor at Carnegie Mellon University

A Machine Learning model is the implementation of an algorithm that can improve performance(P) at executing some task (T) over time with Experience(E).

5. Machine Learning Algorithms

Algorithms are nothing but a series of steps for processing and assimilating data. A Machine learning algorithm aids the computer use the training data it has and generate a model. ML algorithms go through the data given to them as input, understand and analyze them and then generate a set of steps, i.e., a model that implements this process.

Based on the type of data they use, ML algorithms are grouped as:

  • Regression algorithms: These algorithms are predictors. They work by understanding the relationship between the various parts of the data. The most common regression algorithm is Linear regression.
  • Decision trees: These algorithms use a particular set of predefined rules to classify data and then reach a decision or recommend action. The most common application of this type of algorithm is recommender systems.
  • Instance-based algorithms: These algorithms can predict if new data will be a part of a group or not. They do so by proximity analysis with other data points. Example: Nearest Neighbor algorithm.
  • Clustering algorithms: Cluster algorithms are algorithms that chunk or group data together based on their properties without prior knowledge of the data to form clusters of similar data. The most common example of this is the Two-step or K-means algorithms.
  • Association algorithms: Association algorithms use association rules to establish “if-then” relations between the data.
  • Neural networks: These algorithms are generally multi-layered. One layer takes input, processes it, and sends it to the inner layers. The inner layers then do calculations and processing on the data to draw conclusions and probabilities. Neural Networks form the Deep Learning set of algorithms. 

6.1 Machine Learning Methodology

Based on the way the machine learning algorithm learns from the data, the algorithms can be classified into:

  • Supervised machine learning algorithms: These algorithms can learn from the old input data and apply it to new data. It uses a set of data called the training dataset, and the model generated can make predictions.
  • Unsupervised machine learning algorithms: These algorithms do not use training data. These algorithms find the structure or pattern to the data and draw its conclusion.
  • Semi-supervised machine learning algorithms: These algorithms are a hybrid, combining elements of both supervised and unsupervised algorithms. It uses training data but also can find the structure to the data. These algorithms increase learning accuracy to a massive degree.
  • Reinforcement machine learning algorithms: These algorithms are trial and error algorithms. These algorithms use the input data to produce actions, errors. They find the ideal behavior to maximize performance. A reinforcement signal, i.e., reward feedback system, is used to reinforce correct or ideal behavior.

6.3 Machine Learning Algorithms

We can classify the most commonly used Algorithms into the following categories.

Supervised Learning 

  • Naïve Bayes Classifier AlgorithmLogistic Regression
  • Decision Trees
  • Random Forests
  • Nearest Neighbors
  • Linear Regression
  • Support Vector Machine Algorithm

Unsupervised Algorithms

  • K Means Clustering Algorithm
  • Anomaly detection
  • Apriori Algorithm

Reinforcement Learning

  • Artificial Neural Networks

These are just the common ones. There are many more algorithms in Machine Learning.

7. How does Python fit into ML?

The following are the reason why Python is the most extensively used programming language for Machine Learning.

  • Rich Package Library:

    Python provides a rich library of packages for enabling all aspects of Machine Learning. The Libraries make the task of data pre-processing, visualizations, and transformation of data a breeze.

    The libraries used extensively for AI and ML are:

    1. Sci-kit learn
    2. Pandas
    3. Keras
    4. TensorFlow
    5. Matplotlib
    6. NLTK
    7. Scikit-image
    8. PyBrain
    9. Caffe
    10. statsmodels
  • Documentation: Python and its libraries have extensive and rich documentation which clarifies how to use the packages.
  • Open Source: IT is open source and so businesses can avoid setup costs.
  • Readability: Python is readable and easy to understand even by a layman.
  • Data Visualization Libraries: Python provides many libraries for ML and provides many libraries for compelling data visualizations.

8. Summary

In this article, we saw what Machine Learning is and how Python supports Machine Learning Algorithms.

Reshma Sathe

I am a recent Master of Computer Science degree graduate from the University Of Illinois at Urbana-Champaign.I have previously worked as a Software Engineer with projects ranging from production support to programming and software engineering.I am currently working on self-driven projects in Java, Python and Angular and also exploring other frontend and backend technologies.
Subscribe
Notify of
guest

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

0 Comments
Inline Feedbacks
View all comments
Back to top button