Machine Learning and its Algorithms

Gayathri siva
9 min readMay 11, 2019

--

Artificial Intelligence is the broader concept of machines being able to carry out tasks in a smarter way. It covers anything which enables the computers to behave like humans.

Machine Learning is a subset of artificial intelligence which focuses mainly on machine learning from their experience and making predictions based on its experience.

Machine Learning is a concept which allows the machine to learn from examples and experience, and that too without being explicitly programmed. So instead of you writing the code, what you do is you feed data to the generic algorithm, and the algorithm machine builds the logic based on the given data.

How does Machine Learning Work?

Machine Learning algorithm is trained using a training data set to create a model. When new input data is introduced to the ML algorithm, it makes a prediction on the basis of the model.

The prediction is evaluated for accuracy and if the accuracy is acceptable, the Machine Learning algorithm is deployed. If the accuracy is not acceptable, the Machine Learning algorithm is trained again and again with an augmented training data set.

It enables the computers or the machines to make data-driven decisions rather than being explicitly programmed for carrying out a certain task. These programs or algorithms are designed in a way that they learn and improve over time when are exposed to new data.

Machine Learning Algorithms:

Machine learning algorithms find natural patterns in data that generate insight and help you make better decisions and predictions.

Choosing the right algorithm can seem overwhelming — there are dozens of supervised, unsupervised and reinforcement machine learning algorithms, and each takes a different approach to learning.

Machine Learning algorithms are an evolution of normal algorithms. They make your programs “smarter”, by allowing them to automatically learn from the data you provide. The algorithm is mainly divided into:

  • Training Phase
  • Testing phase

Model:

A model is the main component of Machine Learning. A model is trained by using a Machine Learning Algorithm. An algorithm maps all the decisions that a model is supposed to take based on the given input, in order to get the correct output.

Predictor Variable:

It is a feature(s) of the data that can be used to predict the output.

Response Variable:

It is the feature or the output variable that needs to be predicted by using the predictor variable(s).

Training Phase:

The Machine Learning model is built using the training data. The training data helps the model to identify key trends and patterns essential to predict the output.

Testing Phase:

After the model is trained, it must be tested to evaluate how accurately it can predict an outcome. This is done by the testing data set.

Types of Machine Learning:

Machine learning is sub-categorized to three types:

· Supervised Learning — Train Me!

· Unsupervised Learning — I am self-sufficient in learning

· Reinforcement Learning — My life My rules! (Hit & Trial)

Supervised Learning:

A supervised learning algorithm takes a known set of input data and known responses to the data (output) and trains a model to generate reasonable predictions for the response to new data.

Supervised learning uses classification and regression techniques to develop predictive models.

Given: training data +desired outputs (labels)

Usecase:

· Cortana

· Weather Apps

· Biometric Attendance

Unsupervised Learning:

Unsupervised learning finds hidden patterns or intrinsic structures in data. It is used to draw inferences from datasets consisting of input data without labeled responses.

Clustering is the most common unsupervised learning technique. It is used for exploratory data analysis to find hidden patterns or groupings in data.

Given: training data (without desired outputs)

Usecase:

· Gene sequence analysis

· Market research

· Object recognition

Reinforcement Learning:

It is the ability of an agent to interact with the environment and find out what is the best outcome. It follows the concept of hit and trial method.

The agent is rewarded or penalized with a point for a correct or a wrong answer, and on the basis of the positive reward points gained the model trains itself. And again once trained it gets ready to predict the new data presented to it.

Rewards from sequence of actions

Usecase:

· Game playing

· Robot in a maze

Type of Problems in Machine Learning:

Regression: In this type of problem the output is a continuous quantity. So, for example, if you want to predict the speed of a car given the distance, it is a Regression problem. Regression problems can be solved by using Supervised Learning algorithms like Linear Regression.

Classification: In this type, the output is a categorical value. Classifying emails into two classes, spam and non-spam is a classification problem that can be solved by using Supervised Learning classification algorithms such as Support Vector Machines, Naive Bayes, Logistic Regression, K Nearest Neighbor, etc.

Clustering: This type of problem involves assigning the input into two or more clusters based on feature similarity. For example, clustering viewers into similar groups based on their interests, age, geography, etc can be done by using Unsupervised Learning algorithms like K-Means Clustering.

Linear Regression:

A form of statistical modeling that attempts to evaluate the relationship between one variable (termed the dependent variable) and one or more other variables (termed the independent variables). It is a form of global analysis as it only produces a single equation for the relationship.

A model for predicting one variable from another.

· One variable, denoted x, is regarded as the predictor, explanatory, or independent variable.

· The other variable, denoted y, is regarded as the response, outcome, or dependent variable.

Consider a simple example of predicting the amount of crop yield based on the amount of rainfall received.

This is pure case of Simple Linear Regression because we have just 2 variables: amount of rainfall (independent variable) and the crop yield (dependent variable).

Real world applications of Simple Linear Regression:

1. Linear Regression can be used to predict the sale of products in the future based on past buying behavior.

2. Economists use Linear Regression to predict the economic growth of a country or state.

3. Sports analyst use linear regression to predict the number of runs or goals a player would score in the coming matches based on previous performances.

4. An organization can use linear regression to figure out how much they would pay to a new joinee based on the years of experience.

5. Linear regression analysis can help a builder to predict how much houses it would sell in the coming months and at what price.

Logistic Regression:

Logistic regression is a statistical method for predicting binary classes. The outcome or target variable is binary in nature.

The outcome could be in the form of Yes / No, 1 / 0, True / False, High/Low, given a set of independent variables.

Consider a simple Logistic Regression example: Medicine, We might want to predict response to treatment, where we might code survivors as 1 and those who don’t survive as 0.

Applications of Logistic Regression:

1. Image Segmentation and Categorization

2. Geographic Image Processing

3. Handwriting recognition

4. Healthcare: Analyzing a group of over million people for myocardial infarction within a period of 10 years is an application area of logistic regression.

5. Prediction whether a person is depressed or not based on bag of words from the corpus seems to be conveniently solvable using logistic regression and SVM.

Decision Tree Algorithm:

A Decision Tree is a Supervised Machine Learning algorithm which looks like an inverted tree, wherein each node represents a predictor variable (feature), the link between the nodes represents a Decision and each leaf node represents an outcome (response variable).

As the name goes, it uses a tree-like model of decisions. They can be used either to drive informal discussion or to map out an algorithm that predicts the best choice mathematically.

A decision tree typically starts with a single node, which branches into possible outcomes. Each of those outcomes leads to additional nodes, which branch off into other possibilities. This gives it a tree-like shape.

Applications of Decision Tree:

· Detection of Fraudulent Financial Statements (FFS)

· Healthcare Management

· Customer Relationship Management

Naive Bayes Algorithm:

Naive Bayes is among one of the most simple and powerful algorithms for classification based on Bayes’ Theorem with an assumption of independence among predictors. Naive Bayes model is easy to build and particularly useful for very large data sets. There are two parts to this algorithm:

· Naive

· Bayes

The Naive Bayes classifier assumes that the presence of a feature in a class is unrelated to any other feature. Even if these features depend on each other or upon the existence of the other features, all of these properties independently contribute to the probability that a particular fruit is an apple or an orange or a banana and that is why it is known as “Naive”.

Bayes Theorem:

Given a Hypothesis H and evidence E, Bayes’ Theorem states that the relationship between the probability of Hypothesis before getting the evidence P(H) and the probability of the hypothesis after getting the evidence P(H|E) is:

Example: Probability of the Card we picked at random to be a King given that it is a Face Card.

Applications of Naive Bayes:

· News Categorization

· Spam Filtering

· Weather Prediction

Random Forest Algorithm:

Random forest algorithm is an ensemble classifier that consists of many decision trees and outputs the class that is the mode of the class’s output by individual trees.

Random Forests are among the most powerful predictive analytic tools.

Random forest algorithm can use both for classification and the regression kind of problems.

Example: Predicting Loan Repayment

Application of Random forest algorithm:

  • Banking
  • Medicine
  • Stock Market
  • E-commerce

KNN Algorithm:

KNN which stand for K Nearest Neighbor is a Supervised Machine Learning algorithm that classifies a new data point into the target class, depending on the features of its neighboring data points.

Require 3 things:

— Feature Space(Training Data)

— Distance metric : to compute distance between records

— The value of k : the number of nearest neighbors to retrieve from which to get majority class

To classify an unknown record:

— Compute distance to other training records

— Identify k nearest neighbors

— Use class labels of nearest neighbors to determine the class label of unknown record

Application of KNN Algorithm:

  • Amazon’s recommendation system

K-Means Clustering Algorithm:

k-means clustering is one of the simplest algorithms which uses unsupervised learning method to solve known clustering issues. k-means clustering require following two inputs.

  1. k = number of clusters
  2. Training set(m) = {x1, x2, x3,……….., xm}

The goal of this algorithm is to find groups in the data, with the number of groups represented by the variable K.

The algorithm works iteratively to assign each data point to one of K groups based on the features that are provided.

Data points are clustered based on feature similarity.

Application of K-Means clustering algorithm:

· Document Classification

· Insurance Fraud Detection

· Cyber-Profiling Criminals

· Call Record Detail Analysis

· Automatic Clustering of IT Alerts

SVM Algorithm:

Support vector machines are supervised learning models with associated learning algorithms that analyze data used for classification and regression analysis.

It uses a technique called the kernel trick to transform your data and then based on these transformations it finds an optimal boundary between the possible outputs.

These are functions which takes low dimensional input space and transform it to a higher dimensional space i.e. it converts not separable problem to separable problem, these functions are called kernels.

Applications of Support Vector Machine Algorithm:

· Face detection

· Bioinformatics

· Text and hypertext categorization

· Classification of images

· Protein fold and remote homology detection

· Handwriting recognition

· Generalized predictive control (GPC)

--

--

No responses yet