0% found this document useful (0 votes)
8 views34 pages

Topic 2

The document provides an overview of machine learning, defining it as a subset of artificial intelligence focused on enabling computers to learn from data and automate decision-making. It discusses various machine learning methods, including supervised and unsupervised learning, and outlines the components of the learning process, such as data storage, abstraction, generalization, and evaluation. Additionally, it highlights the applications of machine learning across different industries and emphasizes the importance of understanding key concepts and terminologies to effectively engage with this field.

Uploaded by

derrickndiema
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views34 pages

Topic 2

The document provides an overview of machine learning, defining it as a subset of artificial intelligence focused on enabling computers to learn from data and automate decision-making. It discusses various machine learning methods, including supervised and unsupervised learning, and outlines the components of the learning process, such as data storage, abstraction, generalization, and evaluation. Additionally, it highlights the applications of machine learning across different industries and emphasizes the importance of understanding key concepts and terminologies to effectively engage with this field.

Uploaded by

derrickndiema
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

BIT 314: MACHINE

LEARNING ALGORITHMS
TRIZA ABUYA
TOPIC 2

machine 29/01/2024 12:48


Learning
Introduction to machinelearning
• Machine learning is a subfield of artificial intelligence (AI). The goal of
machine learning generally is to understand the structure of data and fit
that data into models that can be understood and utilized by people.
• Machine learning facilitates computers in building models from sample
data in order to automate decision-making processes based on data
inputs.

machine 29/01/2024 12:48


Learning
ML contd;
• Any technology user today has benefitted from machine learning.
Facial recognition technology allows social media platforms to help
users tag and share photos of friends. Optical character recognition
(OCR) technology converts images of text into movable type.
Recommendation engines, powered by machine learning, suggest
what movies or television shows to watch next based on user
preferences. Self-driving cars that rely on machine learning to
navigate may soon be available to consumers.
• Machine learning is a continuously developing field. Because of this,
there are some considerations to keep in mind as you work with
machine learning methodologies, or analyze the impact of machine
learning processes.
machine 29/01/2024 12:48
Learning
Machine LearningMethods

• In machine learning, tasks are generally classified into broad


categories. These categories are based on how learning is received or
how feedback on the learning is given to the system developed.
• Two of the most widely adopted machine learning methods are
supervised learning which trains algorithms based on example input
and output data that is labeled by humans, and unsupervised
learning which provides the algorithm with no labeled data in order
to allow it to find structure within its input data. Let’s explore these
methods in more detail.

machine 29/01/2024 12:48


Learning
Supervised Machine learning
• In supervised learning, the computer is provided with example inputs that are
labeled with their desired outputs. The purpose of this method is for the
algorithm to be able to “learn” by comparing its actual output with the
“taught” outputs to find errors, and modify the model accordingly.
Supervised learning therefore uses patterns to predict label values on
additional unlabeled data.
• For example, with supervised learning, an algorithm may be fed data with
images of sharks labeled as fish and images of oceans labeled as water.
• being trained on this data, the supervised learning algorithm should be able to
identify unlabeled shark images as fish and unlabeled ocean images as water.
A common use case of supervised learning is to use historical data to predict
statistically likely future events.

machine 29/01/2024 12:48


Learning
Unsupervised machine learning
• In unsupervised learning, data is unlabeled, so the learning algorithm is left to find
commonalities among its input data. As unlabeled data are more abundant than labeled
data, machine learning methods that facilitate unsupervised learning are particularly
valuable.
• The goal of unsupervised learning may be as straightforward as discovering hidden
patterns within a dataset, but it may also have a goal of feature learning, which allows
the computational machine to automatically discover the representations that are
needed to classify raw data.
• Unsupervised learning is commonly used for transactional data. You may have a large
dataset of customers and their purchases, but as a human you will likely not be able to
make sense of what similar attributes can be drawn from customer profiles and their
types of purchases. With this data fed into an unsupervised learning algorithm, it may be
determined that women of a certain age range who buy unscented soaps are likely to be
pregnant, and therefore a marketing campaign related to pregnancy and baby products
can be targeted to this audience in order to increase their number of purchases.

machine 29/01/2024 12:48


Learning
Components of learning
• Basic components of learning process The learning process, whether
by a human or a machine, can be divided into four components,
namely, data storage, abstraction, generalization and evaluation.
Figure 1.1 illustrates the variouscomponents and the steps involved in
the learning process.

machine 29/01/2024 12:48


Learning
1. Data storage :Facilities for storing and retrieving huge amounts of data
are an important component of the learning process. Humans and
computers alike utilize data storage as a foundation for advanced
reasoning. • In a human being, the data is stored in the brain and data is
retrieved using electrochemical signals. • Computers use hard disk
drives, flash memory, random access memory and similar devices to
store data and use cables and other technology to retrieve data.
2. 2. Abstraction : The second component of the learning process is known
as abstraction. Abstraction is the process of extracting knowledge about
stored data. This involves creating general concepts about the data as a
whole. The creation of knowledge involves application of known models
and creation of new models. The process of fitting a model to a dataset is
known as training. When the model has been trained, the data is
transformed into an abstract form that summarizes the original
information.

machine 29/01/2024 12:48


Learning
[Link]: The third component of the learning process is known
as generalization. The term generalization describes the process of
turning the knowledge about stored data into a form that can be
utilized for future action. These actions are to be carried out on tasks
that are similar, but not identical, to those what have been seen before.
In generalization, the goal is to discover those properties of the data
that will be most relevant to future tasks.
[Link]: Evaluation is the last component of the learning process.
It is the process of giving feedback to the user to measure the utility of
the learned knowledge. This feedback is then utilized to effect
improvements in the whole learning process

machine 29/01/2024 12:48


Learning
Applications of machine learning
The following is a list of some of the typical applications of machine learning.
1. In retail business, machine learning is used to study consumer behaviour.
[Link] finance, banks analyze their past data to build models to use in credit applications, fraud detection, and
the stock market.
3. In manufacturing, learning models are used for optimization, control, and troubleshooting.
4. In medicine, learning programs are used for medical diagnosis.
[Link] telecommunications, call patterns are analyzed for network optimization and maximizing the quality of
service.
6. In science, large amounts of data in physics, astronomy, and biology can only be analyzed fast enough by
computers. The World Wide Web is huge; it is constantly growing and searching for relevant information
cannot be done manually.
[Link] artificial intelligence, it is used to teach a system to learn and adapt to changes so that the system
designer need not foresee and provide solutions for all possible situations.
8. It is used to find solutions to many problems in vision, speech recognition, and robotics.
[Link] learning methods are applied in the design of computer-controlled vehicles to steer correctly when
driving on a variety of roads.
[Link] learning methods have been used to develop programmes for playing games such as chess,
backgammon and Go.

machine 29/01/2024 12:48


Learning
Application of machine learningcontd’
• Email spam detection
• Face detection and matching (e.g., iPhone X, Windows laptops, etc.)
• Web search (e.g., DuckDuckGo, Bing, Baidu, Google)
• Sports predictions
• Post office (e.g., sorting letters by zip codes)
• ATMs (e.g., reading checks)
• Credit card fraud
• Stock predictions
• Smart assistants (Apple Siri, Amazon Alexa, . . . )
• Product recommendations (e.g., Walmart, Netflix, Amazon)
• Self-driving cars (e.g., Uber, Tesla)
• Language translation (Google translate)
• Sentiment analysis
• Drug design
• Medical diagnoses

machine 29/01/2024 12:48


Learning
• While we go over some of these applications in class, it is a good
exercise to think about how machine learning could be applied in
these problem areas or tasks listed above:
• What is the desired outcome?
• What could the dataset look like?
•Is this a supervised or unsupervised problem, and what algorithms
would you use? (Supervised and unsupervised learning will be
introduced below.)
• How would you measure success?
• What are potential challenges or pitfalls

machine 29/01/2024 12:48


Learning
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA

INTRODUCTION TO MACHINE LEARNING


1. Simple Definition of Machine Learning
2. What is Machine Learning
3. Why Should We Learn Machine Learning
4. How to Get Started With Machine Learning
5. The Seven Steps of Machine Learning
6. How Does Machine Learning Work?
7. Which Programming Language is Best For Machine Learning
8. Difference between Machine Learning and Artificial Intelligence
9. Types of Machine Learning
10. Applications of Machine Learning
11. FAQs

Simple Definition of Machine Learning


Machine Learning is an Application of Artificial Intelligence (AI) it gives devices the ability to
learn from their experiences and improve their self without doing any coding. For Example,
when you shop from any website it’s shows related search like:- People who bought also saw
this.

What is Machine Learning?


Machine Learning is a subset of Artificial Intelligence. Machine Learning is the study of making
machines more human-like in their behaviour and decisions by giving them the ability to learn
and develop their own programs. This is done with minimum human intervention, i.e., no
explicit programming. The learning process is automated and improved based on the experiences
of the machines throughout the process. Good quality data is fed to the machines, and different
algorithms are used to build ML models to train the machines on this data. The choice of
algorithm depends on the type of data at hand, and the type of activity that needs to be
automated.

Now you may wonder, how is it different from traditional programming? Well, in traditional
programming, we would feed the input data and a well written and tested program into a
machine to generate output. When it comes to machine learning, input data along with the output
is fed into the machine during the learning phase, and it works out a program for itself. To
understand this better, refer to the illustration below:
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA

Why Should We Learn Machine Learning?


Machine Learning today has all the attention it needs. Machine Learning can automate many
tasks, especially the ones that only humans can perform with their innate intelligence.
Replicating this intelligence to machines can be achieved only with the help of machine
learning.

With the help of Machine Learning, businesses can automate routine tasks. It also helps in
automating and quickly create models for data analysis. Various industries depend on vast
quantities of data to optimize their operations and make intelligent decisions. Machine Learning
helps in creating models that can process and analyze large amounts of complex data to deliver
accurate results. These models are precise and scalable and function with less turnaround time.
By building such precise Machine Learning models, businesses can leverage profitable
opportunities and avoid unknown risks.

Image recognition, text generation, and many other use-cases are finding applications in the real
world. This is increasing the scope for machine learning experts to shine as a sought after
professionals.

How to get started with Machine Learning?


To get started with Machine Learning, let’s take a look at some of the important terminologies
used in Machine Learning:

Some Terminology of Machine Learning

• Model: Also known as “hypothesis”, a machine learning model is the mathematical


representation of a real-world process. A machine learning algorithm along with the
training data builds a machine learning model.
• Feature: A feature is a measurable property or parameter of the data-set.
• Feature Vector: It is a set of multiple numeric features. We use it as an input to the
machine learning model for training and prediction purposes.
• Training: An algorithm takes a set of data known as “training data” as input. The
learning algorithm finds patterns in the input data and trains the model for expected
results (target). The output of the training process is the machine learning model.
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
• Prediction: Once the machine learning model is ready, it can be fed with input data to
provide a predicted output.
• Target (Label): The value that the machine learning model has to predict is called the
target or label.
• Overfitting: When a massive amount of data trains a machine learning model, it tends to
learn from the noise and inaccurate data entries. Here the model fails to characterise the
data correctly.
• Underfitting: It is the scenario when the model fails to decipher the underlying trend in
the input data. It destroys the accuracy of the machine learning model. In simple terms,
the model or the algorithm does not fit the data well enough.
Here’s a video that describes step by step guide to approaching a Machine Learning
problem with a beer and wine example:

There are Seven Steps of Machine Learning


1. Gathering Data
2. Preparing that data
3. Choosing a model
4. Training
5. Evaluation
6. Hyperparameter Tuning
7. Prediction

It is mandatory to learn a programming language, preferably Python, along with the required
analytical and mathematical knowledge. Here are the three mathematical areas that you need to
brush up before jumping into solving Machine Learning problems:
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
1. Linear algebra for data analysis: Scalars, Vectors, Matrices, and Tensors
2. Mathematical Analysis: Derivatives and Gradients
3. Probability theory and statistics
4. Multivariate Calculus
5. Algorithms and Complex Optimizations

How does Machine Learning work?


The three major building blocks of a Machine Learning system are the model, the parameters,
and the learner.

• Model is the system which makes predictions


• The parameters are the factors which are considered by the model to make predictions
• The learner makes the adjustments in the parameters and the model to align the
predictions with the actual results

Let us build on the beer and wine example to understand how machine learning works. A
machine learning model here has to predict if a drink is a beer or wine. The parameters selected
are the colour of the drink and the alcohol percentage. The first step is:

Learning from the training set

This involves taking a sample data set of several drinks for which the colour and alcohol
percentage is specified. Now, we have to define the description of each classification, that is
wine and beer, in terms of the value of parameters for each type. The model can use the
description to decide if a new drink is a wine or beer.

You can represent the values of the parameters, ‘colour’ and ‘alcohol percentages’ as ‘x’ and ‘y’
respectively. Then (x,y) defines the parameters of each drink in the training data. This set of data
is called a training set. These values, when plotted on a graph, present a hypothesis in the form of
a line, a rectangle, or a polynomial that fits best to the desired results.

The second step is to measure error

Once the model is trained on a defined training set, it needs to be checked for discrepancies and
errors. We use a fresh set of data to accomplish this task. The outcome of this test would be one
of these four:

• True Positive: When the model predicts the condition when it is present
• True Negative: When the model does not predict a condition when it is absent
• False Positive: When the model predicts a condition when it is absent
• False Negative: When the model does not predict a condition when it is present
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA

The sum of FP and FN is the total error in the model.

Manage Noise

For the sake of simplicity, we have considered only two parameters to approach a machine
learning problem here that is the colour and alcohol percentage. But in reality, you will have to
consider hundreds of parameters and a broad set of learning data to solve a machine learning
problem.

• The hypothesis then created will have a lot more errors because of the noise. Noise is the
unwanted anomalies that disguise the underlying relationship in the data set and weakens
the learning process. Various reasons for this noise to occur are:
• Large training data set
• Errors in input data
• Data labelling errors
• Unobservable attributes that might affect the classification but are not considered in the
training set due to lack of data

You can accept a certain degree of training error due to noise to keep the hypothesis as simple as
possible.

Testing and Generalization

While it is possible for an algorithm or hypothesis to fit well to a training set, it might fail when
applied to another set of data outside of the training set. Therefore, It is essential to figure out if
the algorithm is fit for new data. Testing it with a set of new data is the way to judge this. Also,
generalization refers to how well the model predicts outcomes for a new set of data.

When we fit a hypothesis algorithm for maximum possible simplicity, it might have less error for
the training data, but might have more significant error while processing new data. We call this is
under-fitting. On the other hand, if the hypothesis is too complicated to accommodate the best
fit to the training result, it might not generalize well. This is the case of over-fitting. In either
case, the results are fed back to train the model further.
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
Which Language is Best for Machine Learning?
Python is hands down the best programming language for Machine Learning applications due to
the various benefits mentioned in the section below. Other programming languages that could to
use for Machine Learning Applications are R, C++, JavaScript, Java, C#, Julia, Shell,
TypeScript, and Scala.

Python is famous for its readability and relatively lower complexity as compared to other
programming languages. Machine Learning applications involve complex concepts like calculus
and linear algebra which take a lot of effort and time to implement. Python helps in reducing this
burden with quick implementation for the ML engineer to validate an idea. You can check out
the Python Tutorial to get a basic understanding of the language. Another benefit of using Python
in Machine Learning is the pre-built libraries. There are different packages for a different type of
applications, as mentioned below:

• Numpy, OpenCV, and Scikit are used when working with images
• NLTK along with Numpy and Scikit again when working with text
• Librosa for audio applications
• Matplotlib, Seaborn, and Scikit for data representation
• TensorFlow and Pytorch for Deep Learning applications
• Scipy for Scientific Computing
• Django for integrating web applications
• Pandas for high-level data structures and analysis

Python provides flexibility in choosing between object-oriented programming or scripting. There


is also no need to recompile the code; developers can implement any changes and instantly see
the results. You can use Python along with other languages to achieve the desired functionality
and results.

Python is a versatile programming language and can run on any platform, including Windows,
MacOS, Linux, Unix, and others. While migrating from one platform to another, the code needs
some minor adaptations and changes, and it is ready to work on the new platform.

Difference Between Machine Learning and Artificial


Intelligence
AI manages more comprehensive issues of automating a system utilizing fields such as cognitive
science, image processing, machine learning, or neural networks for computerization. On the
other hand, ML influences a machine to gain and learn from the external environment. The
external environment could be anything such as external storage devices, sensors, electronic
segments among others.

Also, artificial intelligence enables machines and frameworks to think and do the tasks as
humans do. While machine learning depends on the inputs provided or queries requested by
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
users. The framework acts on the input by screening if it is available in the knowledge base and
then provides output.

Types of Machine Learning


In this section, we will learn about the different approaches towards machine learning and the
variety of problems they can solve.

What is Supervised Learning?

The supervised learning model has a set of input variables (x), and an output variable (y). An
algorithm identifies the mapping function between the input and output variables. The
relationship is y = f(x).

The learning is monitored or supervised in the sense that we already know the output and the
algorithm are corrected each time to optimise its results. The algorithm is trained over the data
set and amended until it achieves an acceptable level of performance.
We can group the supervised learning problems as:

1. Regression problems – Used to predict future values and the model is trained with the
historical data. E.g., Predicting the future price of a product.
2. Classification problems – Various labels train the algorithm to identify items within a
specific category. E.g., Disease or no disease, Apple or an orange, Beer or wine.

What is Unsupervised Learning?

This approach is the one where the output is unknown, and we have only the input variable at
hand. The algorithm learns by itself and discovers an impressive structure in the data.
The goal is to decipher the underlying distribution in the data to gain more knowledge about the
data.
We can group the unsupervised learning problems as:

1. Clustering: This means bundling the input variables with the same characteristics
together. E.g., grouping users based on search history
2. Association: Here, we discover the rules that govern meaningful associations among the
data set. E.g., People who watch ‘X’ will also watch ‘Y.’

What is Semi-supervised Learning?

In semi-supervised learning, data scientists train model with a minimal amount of labelled data
and a large amount of unlabelled data. Usually, the first step is to cluster similar data with the
help of an unsupervised machine learning algorithm. The next step is to label the unlabelled data
using the characteristics of the limited labelled data available. After labelling the complete data,
one can use supervised learning algorithms to solve the problem.
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
What is Reinforcement Learning?

In this approach, machine learning models are trained to make a series of decisions based on the
rewards and feedback they receive for their actions. The machine learns to achieve a goal in
complex and uncertain situations and is rewarded each time it achieves it during the learning
period.

Reinforcement learning is different from supervised learning in the sense that there is no answer
available, so the reinforcement agent decides the steps to perform a task. The machine learns
from its own experiences when there is no training data set present.
Machine Learning algorithms help in building intelligent systems that can learn from their past
experiences and historical data to give accurate results. Many industries are thus applying
machine learning solutions to their business problems, or to create new and better products and
services. Healthcare, defence, financial services, marketing, and security services, among others,
use Machine Learning in their applications and processes.

Applications of Machine Learning


Facial recognition/Image recognition

The most common application of machine learning is Facial Recognition, and the simplest
example of this application is the iPhone X. There are a lot of use-cases of facial recognition,
mostly for security purposes like identifying criminals, searching for missing individuals, aid
forensic investigations, etc. Intelligent marketing, diagnose diseases, track attendance in schools,
are some other uses.

Automatic Speech Recognition

Abbreviated as ASR, automatic speech recognition is used to convert speech into digital text. Its
applications lie in authenticating users based on their voice and performing tasks based on the
human voice inputs. Speech patterns and vocabulary are fed into the system to train the model.
Presently ASR systems find a wide variety of applications in the following domains:

• Medical Assistance
• Industrial Robotics
• Forensic and Law enforcement
• Defence & Aviation
• Telecommunications Industry
• Home Automation and Security Access Control
• I.T. and Consumer Electronics

Financial Services

Machine learning has many use cases in Financial Services. Machine Learning algorithms prove
to be excellent at detecting frauds by monitoring activities of each user and assess that if an
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
attempted activity is typical of that user or not.
Financial monitoring to detect money laundering activities is also a critical security use case of
machine learning.

Machine Learning also helps in making better trading decisions with the help of algorithms that
can analyse thousands of data sources simultaneously. Credit scoring and underwriting are some
of the other applications.
The most common application in our day to day activities is the virtual personal assistants like
Siri and Alexa.

Marketing and Sales

Machine Learning is improving lead scoring algorithms by including various parameters such as
website visits, emails opened, downloads, and clicks to score each lead. It also helps businesses
to improve their dynamic pricing models by using regression techniques to make predictions.

Sentiment Analysis is another essential application to gauge consumer response to a specific


product or a marketing initiative. Machine Learning for Computer Vision helps brands identify
their products in images and videos online. These brands also use computer vision to measure the
mentions that miss out on any relevant text. Chatbots are also becoming more responsive and
intelligent with the help of machine learning.

Healthcare

A vital application of Machine Learning is in the diagnosis of diseases and ailments, which are
otherwise difficult to diagnose. Radiotherapy is also becoming better with Machine Learning
taking over.

Early-stage drug discovery is another crucial application which involves technologies such as
precision medicine and next-generation sequencing. Clinical trials cost a lot of time and money
to complete and deliver results. Applying Machine Learning based predictive analytics could
improve on these factors and give better results.

Machine Learning technologies are also critical to make outbreak predictions. Scientists around
the world are using these technologies to predict epidemic outbreaks.

Recommendation Systems

Many businesses today use recommendation systems to effectively communicate with the users
on their site. It can recommend relevant products, movies, web-series, songs, and much more.
Most prominent use-cases of recommendation systems are e-commerce sites like Amazon,
Flipkart, and many others, along with Spotify, Netflix, and other web-streaming channels.

Machine Learning FAQs


INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
1. What exactly is machine learning?

Arthur Samuel coined the term Machine Learning in 1959. He defined it as “The field of study
that gives computers the capability to learn without being explicitly programmed”. Machine
Learning is a subset of Artificial Intelligence and it allows machines to learn from their
experiences without any coding.

2. What is machine learning used for?

Machine Learning is used in our daily lives much more than we know it. These are areas where
machine learning is used:

• Facial Recognition
• Self-driving cars
• Virtual assistants
• Traffic Predictions
• Speech Recognition
• Online Fraud Detection
• Email Spam Filtering
• Product Recommendations

3. What is difference between machine learning and artificial intelligence?

A technology that enables a machine to stimulate human behavior to help in solving complex
problems is known as Artificial Intelligence. Machine Learning is a subset of AI and allows
machines to learn from past data and provide an accurate output. AI deals with unstructured as
well as structured data. Whereas, Machine Learning deals with structured and semi-structured
data.

4. How Machine Learning works?

The typical machine learning process involves three steps: Training, Validation, and Testing.
The first step is to learn from the training set provided, the second step is to measure error, the
third step involves managing noise and testing all the parameters. These are the basic steps
followed and a very broad description on how machine learning works.

5. What are the types of Machine Learning?

The broad types of machine learning are:

• Supervised Machine Learning


• Unsupervised Machine Learning
• Semi-supervised Learning
• Reinforcement Learning

6. What is the best language for machine learning?


INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
The best programming language to learn machine learning can be any of the following: Python,
R, Java and JavaScript, Julia. However, in today’s day and age, Python is the most commonly
used programming language due to it’s ease and simplicity. The number of programmers using
Python as their primary coding language is increasing.

7. Is Alexa a machine learning?

Alexa is a virtual assistant that is created by Amazon and is also known as Amazon Alexa. This
virtual assistant was created using machine learning and artificial intelligence technologies.

8. Is Siri a machine learning?

Similar to Alexa, Siri is also a virtual or a personal assistant. Siri was created by Apple and
makes use of voice technology to perform certain actions. Siri also makes use of machine
learning and deep learning to function.

9. Why is machine learning popular?

The amount of data available to us is constantly increasing. Machines make use of this data to
learn and improve the results and outcomes provided to us. These outcomes can be extremely
helpful in providing valuable insights and taking informed business decisions as well. Machine
Learning is constantly growing, and with that, the applications of machine learning are growing
as well. We make use of machine learning in our day-to-day life more than we know it. In the
future, machine learning is only said to grow further and help us. Thus, it is popular.
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA

INTRODUCTION TO MACHINE LEARNING


1. Simple Definition of Machine Learning
2. What is Machine Learning
3. Why Should We Learn Machine Learning
4. How to Get Started With Machine Learning
5. The Seven Steps of Machine Learning
6. How Does Machine Learning Work?
7. Which Programming Language is Best For Machine Learning
8. Difference between Machine Learning and Artificial Intelligence
9. Types of Machine Learning
10. Applications of Machine Learning
11. FAQs

Simple Definition of Machine Learning


Machine Learning is an Application of Artificial Intelligence (AI) it gives devices the ability to
learn from their experiences and improve their self without doing any coding. For Example,
when you shop from any website it’s shows related search like:- People who bought also saw
this.

What is Machine Learning?


Machine Learning is a subset of Artificial Intelligence. Machine Learning is the study of making
machines more human-like in their behaviour and decisions by giving them the ability to learn
and develop their own programs. This is done with minimum human intervention, i.e., no
explicit programming. The learning process is automated and improved based on the experiences
of the machines throughout the process. Good quality data is fed to the machines, and different
algorithms are used to build ML models to train the machines on this data. The choice of
algorithm depends on the type of data at hand, and the type of activity that needs to be
automated.

Now you may wonder, how is it different from traditional programming? Well, in traditional
programming, we would feed the input data and a well written and tested program into a
machine to generate output. When it comes to machine learning, input data along with the output
is fed into the machine during the learning phase, and it works out a program for itself. To
understand this better, refer to the illustration below:
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA

Why Should We Learn Machine Learning?


Machine Learning today has all the attention it needs. Machine Learning can automate many
tasks, especially the ones that only humans can perform with their innate intelligence.
Replicating this intelligence to machines can be achieved only with the help of machine
learning.

With the help of Machine Learning, businesses can automate routine tasks. It also helps in
automating and quickly create models for data analysis. Various industries depend on vast
quantities of data to optimize their operations and make intelligent decisions. Machine Learning
helps in creating models that can process and analyze large amounts of complex data to deliver
accurate results. These models are precise and scalable and function with less turnaround time.
By building such precise Machine Learning models, businesses can leverage profitable
opportunities and avoid unknown risks.

Image recognition, text generation, and many other use-cases are finding applications in the real
world. This is increasing the scope for machine learning experts to shine as a sought after
professionals.

How to get started with Machine Learning?


To get started with Machine Learning, let’s take a look at some of the important terminologies
used in Machine Learning:

Some Terminology of Machine Learning

• Model: Also known as “hypothesis”, a machine learning model is the mathematical


representation of a real-world process. A machine learning algorithm along with the
training data builds a machine learning model.
• Feature: A feature is a measurable property or parameter of the data-set.
• Feature Vector: It is a set of multiple numeric features. We use it as an input to the
machine learning model for training and prediction purposes.
• Training: An algorithm takes a set of data known as “training data” as input. The
learning algorithm finds patterns in the input data and trains the model for expected
results (target). The output of the training process is the machine learning model.
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
• Prediction: Once the machine learning model is ready, it can be fed with input data to
provide a predicted output.
• Target (Label): The value that the machine learning model has to predict is called the
target or label.
• Overfitting: When a massive amount of data trains a machine learning model, it tends to
learn from the noise and inaccurate data entries. Here the model fails to characterise the
data correctly.
• Underfitting: It is the scenario when the model fails to decipher the underlying trend in
the input data. It destroys the accuracy of the machine learning model. In simple terms,
the model or the algorithm does not fit the data well enough.
Here’s a video that describes step by step guide to approaching a Machine Learning
problem with a beer and wine example:

There are Seven Steps of Machine Learning


1. Gathering Data
2. Preparing that data
3. Choosing a model
4. Training
5. Evaluation
6. Hyperparameter Tuning
7. Prediction

It is mandatory to learn a programming language, preferably Python, along with the required
analytical and mathematical knowledge. Here are the three mathematical areas that you need to
brush up before jumping into solving Machine Learning problems:
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
1. Linear algebra for data analysis: Scalars, Vectors, Matrices, and Tensors
2. Mathematical Analysis: Derivatives and Gradients
3. Probability theory and statistics
4. Multivariate Calculus
5. Algorithms and Complex Optimizations

How does Machine Learning work?


The three major building blocks of a Machine Learning system are the model, the parameters,
and the learner.

• Model is the system which makes predictions


• The parameters are the factors which are considered by the model to make predictions
• The learner makes the adjustments in the parameters and the model to align the
predictions with the actual results

Let us build on the beer and wine example to understand how machine learning works. A
machine learning model here has to predict if a drink is a beer or wine. The parameters selected
are the colour of the drink and the alcohol percentage. The first step is:

Learning from the training set

This involves taking a sample data set of several drinks for which the colour and alcohol
percentage is specified. Now, we have to define the description of each classification, that is
wine and beer, in terms of the value of parameters for each type. The model can use the
description to decide if a new drink is a wine or beer.

You can represent the values of the parameters, ‘colour’ and ‘alcohol percentages’ as ‘x’ and ‘y’
respectively. Then (x,y) defines the parameters of each drink in the training data. This set of data
is called a training set. These values, when plotted on a graph, present a hypothesis in the form of
a line, a rectangle, or a polynomial that fits best to the desired results.

The second step is to measure error

Once the model is trained on a defined training set, it needs to be checked for discrepancies and
errors. We use a fresh set of data to accomplish this task. The outcome of this test would be one
of these four:

• True Positive: When the model predicts the condition when it is present
• True Negative: When the model does not predict a condition when it is absent
• False Positive: When the model predicts a condition when it is absent
• False Negative: When the model does not predict a condition when it is present
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA

The sum of FP and FN is the total error in the model.

Manage Noise

For the sake of simplicity, we have considered only two parameters to approach a machine
learning problem here that is the colour and alcohol percentage. But in reality, you will have to
consider hundreds of parameters and a broad set of learning data to solve a machine learning
problem.

• The hypothesis then created will have a lot more errors because of the noise. Noise is the
unwanted anomalies that disguise the underlying relationship in the data set and weakens
the learning process. Various reasons for this noise to occur are:
• Large training data set
• Errors in input data
• Data labelling errors
• Unobservable attributes that might affect the classification but are not considered in the
training set due to lack of data

You can accept a certain degree of training error due to noise to keep the hypothesis as simple as
possible.

Testing and Generalization

While it is possible for an algorithm or hypothesis to fit well to a training set, it might fail when
applied to another set of data outside of the training set. Therefore, It is essential to figure out if
the algorithm is fit for new data. Testing it with a set of new data is the way to judge this. Also,
generalization refers to how well the model predicts outcomes for a new set of data.

When we fit a hypothesis algorithm for maximum possible simplicity, it might have less error for
the training data, but might have more significant error while processing new data. We call this is
under-fitting. On the other hand, if the hypothesis is too complicated to accommodate the best
fit to the training result, it might not generalize well. This is the case of over-fitting. In either
case, the results are fed back to train the model further.
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
Which Language is Best for Machine Learning?
Python is hands down the best programming language for Machine Learning applications due to
the various benefits mentioned in the section below. Other programming languages that could to
use for Machine Learning Applications are R, C++, JavaScript, Java, C#, Julia, Shell,
TypeScript, and Scala.

Python is famous for its readability and relatively lower complexity as compared to other
programming languages. Machine Learning applications involve complex concepts like calculus
and linear algebra which take a lot of effort and time to implement. Python helps in reducing this
burden with quick implementation for the ML engineer to validate an idea. You can check out
the Python Tutorial to get a basic understanding of the language. Another benefit of using Python
in Machine Learning is the pre-built libraries. There are different packages for a different type of
applications, as mentioned below:

• Numpy, OpenCV, and Scikit are used when working with images
• NLTK along with Numpy and Scikit again when working with text
• Librosa for audio applications
• Matplotlib, Seaborn, and Scikit for data representation
• TensorFlow and Pytorch for Deep Learning applications
• Scipy for Scientific Computing
• Django for integrating web applications
• Pandas for high-level data structures and analysis

Python provides flexibility in choosing between object-oriented programming or scripting. There


is also no need to recompile the code; developers can implement any changes and instantly see
the results. You can use Python along with other languages to achieve the desired functionality
and results.

Python is a versatile programming language and can run on any platform, including Windows,
MacOS, Linux, Unix, and others. While migrating from one platform to another, the code needs
some minor adaptations and changes, and it is ready to work on the new platform.

Difference Between Machine Learning and Artificial


Intelligence
AI manages more comprehensive issues of automating a system utilizing fields such as cognitive
science, image processing, machine learning, or neural networks for computerization. On the
other hand, ML influences a machine to gain and learn from the external environment. The
external environment could be anything such as external storage devices, sensors, electronic
segments among others.

Also, artificial intelligence enables machines and frameworks to think and do the tasks as
humans do. While machine learning depends on the inputs provided or queries requested by
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
users. The framework acts on the input by screening if it is available in the knowledge base and
then provides output.

Types of Machine Learning


In this section, we will learn about the different approaches towards machine learning and the
variety of problems they can solve.

What is Supervised Learning?

The supervised learning model has a set of input variables (x), and an output variable (y). An
algorithm identifies the mapping function between the input and output variables. The
relationship is y = f(x).

The learning is monitored or supervised in the sense that we already know the output and the
algorithm are corrected each time to optimise its results. The algorithm is trained over the data
set and amended until it achieves an acceptable level of performance.
We can group the supervised learning problems as:

1. Regression problems – Used to predict future values and the model is trained with the
historical data. E.g., Predicting the future price of a product.
2. Classification problems – Various labels train the algorithm to identify items within a
specific category. E.g., Disease or no disease, Apple or an orange, Beer or wine.

What is Unsupervised Learning?

This approach is the one where the output is unknown, and we have only the input variable at
hand. The algorithm learns by itself and discovers an impressive structure in the data.
The goal is to decipher the underlying distribution in the data to gain more knowledge about the
data.
We can group the unsupervised learning problems as:

1. Clustering: This means bundling the input variables with the same characteristics
together. E.g., grouping users based on search history
2. Association: Here, we discover the rules that govern meaningful associations among the
data set. E.g., People who watch ‘X’ will also watch ‘Y.’

What is Semi-supervised Learning?

In semi-supervised learning, data scientists train model with a minimal amount of labelled data
and a large amount of unlabelled data. Usually, the first step is to cluster similar data with the
help of an unsupervised machine learning algorithm. The next step is to label the unlabelled data
using the characteristics of the limited labelled data available. After labelling the complete data,
one can use supervised learning algorithms to solve the problem.
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
What is Reinforcement Learning?

In this approach, machine learning models are trained to make a series of decisions based on the
rewards and feedback they receive for their actions. The machine learns to achieve a goal in
complex and uncertain situations and is rewarded each time it achieves it during the learning
period.

Reinforcement learning is different from supervised learning in the sense that there is no answer
available, so the reinforcement agent decides the steps to perform a task. The machine learns
from its own experiences when there is no training data set present.
Machine Learning algorithms help in building intelligent systems that can learn from their past
experiences and historical data to give accurate results. Many industries are thus applying
machine learning solutions to their business problems, or to create new and better products and
services. Healthcare, defence, financial services, marketing, and security services, among others,
use Machine Learning in their applications and processes.

Applications of Machine Learning


Facial recognition/Image recognition

The most common application of machine learning is Facial Recognition, and the simplest
example of this application is the iPhone X. There are a lot of use-cases of facial recognition,
mostly for security purposes like identifying criminals, searching for missing individuals, aid
forensic investigations, etc. Intelligent marketing, diagnose diseases, track attendance in schools,
are some other uses.

Automatic Speech Recognition

Abbreviated as ASR, automatic speech recognition is used to convert speech into digital text. Its
applications lie in authenticating users based on their voice and performing tasks based on the
human voice inputs. Speech patterns and vocabulary are fed into the system to train the model.
Presently ASR systems find a wide variety of applications in the following domains:

• Medical Assistance
• Industrial Robotics
• Forensic and Law enforcement
• Defence & Aviation
• Telecommunications Industry
• Home Automation and Security Access Control
• I.T. and Consumer Electronics

Financial Services

Machine learning has many use cases in Financial Services. Machine Learning algorithms prove
to be excellent at detecting frauds by monitoring activities of each user and assess that if an
INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
attempted activity is typical of that user or not.
Financial monitoring to detect money laundering activities is also a critical security use case of
machine learning.

Machine Learning also helps in making better trading decisions with the help of algorithms that
can analyse thousands of data sources simultaneously. Credit scoring and underwriting are some
of the other applications.
The most common application in our day to day activities is the virtual personal assistants like
Siri and Alexa.

Marketing and Sales

Machine Learning is improving lead scoring algorithms by including various parameters such as
website visits, emails opened, downloads, and clicks to score each lead. It also helps businesses
to improve their dynamic pricing models by using regression techniques to make predictions.

Sentiment Analysis is another essential application to gauge consumer response to a specific


product or a marketing initiative. Machine Learning for Computer Vision helps brands identify
their products in images and videos online. These brands also use computer vision to measure the
mentions that miss out on any relevant text. Chatbots are also becoming more responsive and
intelligent with the help of machine learning.

Healthcare

A vital application of Machine Learning is in the diagnosis of diseases and ailments, which are
otherwise difficult to diagnose. Radiotherapy is also becoming better with Machine Learning
taking over.

Early-stage drug discovery is another crucial application which involves technologies such as
precision medicine and next-generation sequencing. Clinical trials cost a lot of time and money
to complete and deliver results. Applying Machine Learning based predictive analytics could
improve on these factors and give better results.

Machine Learning technologies are also critical to make outbreak predictions. Scientists around
the world are using these technologies to predict epidemic outbreaks.

Recommendation Systems

Many businesses today use recommendation systems to effectively communicate with the users
on their site. It can recommend relevant products, movies, web-series, songs, and much more.
Most prominent use-cases of recommendation systems are e-commerce sites like Amazon,
Flipkart, and many others, along with Spotify, Netflix, and other web-streaming channels.

Machine Learning FAQs


INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
1. What exactly is machine learning?

Arthur Samuel coined the term Machine Learning in 1959. He defined it as “The field of study
that gives computers the capability to learn without being explicitly programmed”. Machine
Learning is a subset of Artificial Intelligence and it allows machines to learn from their
experiences without any coding.

2. What is machine learning used for?

Machine Learning is used in our daily lives much more than we know it. These are areas where
machine learning is used:

• Facial Recognition
• Self-driving cars
• Virtual assistants
• Traffic Predictions
• Speech Recognition
• Online Fraud Detection
• Email Spam Filtering
• Product Recommendations

3. What is difference between machine learning and artificial intelligence?

A technology that enables a machine to stimulate human behavior to help in solving complex
problems is known as Artificial Intelligence. Machine Learning is a subset of AI and allows
machines to learn from past data and provide an accurate output. AI deals with unstructured as
well as structured data. Whereas, Machine Learning deals with structured and semi-structured
data.

4. How Machine Learning works?

The typical machine learning process involves three steps: Training, Validation, and Testing.
The first step is to learn from the training set provided, the second step is to measure error, the
third step involves managing noise and testing all the parameters. These are the basic steps
followed and a very broad description on how machine learning works.

5. What are the types of Machine Learning?

The broad types of machine learning are:

• Supervised Machine Learning


• Unsupervised Machine Learning
• Semi-supervised Learning
• Reinforcement Learning

6. What is the best language for machine learning?


INTRODUCTION TO ML
TRIZA KWAMBOKA ABUYA
The best programming language to learn machine learning can be any of the following: Python,
R, Java and JavaScript, Julia. However, in today’s day and age, Python is the most commonly
used programming language due to it’s ease and simplicity. The number of programmers using
Python as their primary coding language is increasing.

7. Is Alexa a machine learning?

Alexa is a virtual assistant that is created by Amazon and is also known as Amazon Alexa. This
virtual assistant was created using machine learning and artificial intelligence technologies.

8. Is Siri a machine learning?

Similar to Alexa, Siri is also a virtual or a personal assistant. Siri was created by Apple and
makes use of voice technology to perform certain actions. Siri also makes use of machine
learning and deep learning to function.

9. Why is machine learning popular?

The amount of data available to us is constantly increasing. Machines make use of this data to
learn and improve the results and outcomes provided to us. These outcomes can be extremely
helpful in providing valuable insights and taking informed business decisions as well. Machine
Learning is constantly growing, and with that, the applications of machine learning are growing
as well. We make use of machine learning in our day-to-day life more than we know it. In the
future, machine learning is only said to grow further and help us. Thus, it is popular.

You might also like