0% found this document useful (0 votes)
10 views

CH1

Machine Learning is a subset of artificial intelligence that enables algorithms to learn from data and make predictions without explicit programming. It differs from traditional programming by being data-driven and capable of finding patterns in large datasets. The document also discusses the relationship between Machine Learning, Artificial Intelligence, and Deep Learning, as well as various types of Machine Learning including supervised, unsupervised, and semi-supervised learning.

Uploaded by

ritenpanchasara
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)
10 views

CH1

Machine Learning is a subset of artificial intelligence that enables algorithms to learn from data and make predictions without explicit programming. It differs from traditional programming by being data-driven and capable of finding patterns in large datasets. The document also discusses the relationship between Machine Learning, Artificial Intelligence, and Deep Learning, as well as various types of Machine Learning including supervised, unsupervised, and semi-supervised learning.

Uploaded by

ritenpanchasara
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
You are on page 1/ 19

BCA & BSCIT SEM-6

SUBJECT:- Machine Learning with Python


CH:-1 Introduction to Machine Learning

 Define Machine Learning

 What is Machine Learning?


 Machine learning is a branch of artificial intelligence
that enables algorithms to uncover hidden patterns
within datasets, allowing them to make predictions on
new, similar data without explicit programming for each
task.
 Traditional machine learning combines data with
statistical tools to predict outputs, yielding actionable
insights.
 This technology finds applications in diverse fields such
as image and speech recognition, natural language
processing, recommendation systems, fraud detection,
portfolio optimization, and automating tasks.
 For instance, recommender systems use historical data
to personalize suggestions. Netflix, for example,
employs collaborative and content-based filtering to
recommend movies and TV shows based on user
viewing history, ratings, and genre preferences.
 Machine learning’s impact extends to autonomous
vehicles, drones, and robots, enhancing their
adaptability in dynamic environments. This approach
marks a breakthrough where machines learn from data
examples to generate accurate outcomes, closely
intertwined with data mining and data science.
 Difference between Machine Learning and Traditional
Programming

Machine Learning Traditional Programming

Machine Learning is a In traditional


subset of artificial programming, rule-based
intelligence(AI) that focus code is written by the
on learning from data to developers depending on
develop an algorithm that the problem statements
can be used to make a
prediction.
Machine Learning uses a Traditional programming is
data-driven approach, It is typically rule-based and
typically trained on deterministic. It hasn’t self-
historical data and then learning features like
used to make predictions Machine Learning and AI
on new data
Machine Learning is the Traditional programming is
subset of AI. And Now it is often used to build
used in various AI-based applications and software
tasks like Chatbot Question systems that have specific
answering, self-driven car., functionality.
etc
ML can find patterns and Traditional programming is
insights in large datasets totally dependent on the
that might be difficult for intelligence of developers.
humans to discover So, it has very limited
capability.

 Relation of ML with AI & DL


Artificial Intelligence(AI)
Artificial Intelligence is basically the mechanism to incorporate human
intelligence into machines through a set of rules(algorithm).

AI is a combination of two words: “Artificial” meaning something


made by humans or non-natural things and “Intelligence” meaning the
ability to understand or think accordingly. Another definition could be
that “AI is basically the study of training your machine(computers) to
mimic a human brain and its thinking capabilities”.

AI focuses on 3 major aspects(skills): learning, reasoning, and self-


correction to obtain the maximum efficiency possible.

Machine Learning:
Machine Learning is basically the study/process which provides the
system(computer) to learn automatically on its own through
experiences it had and improve accordingly without being explicitly
programmed.

ML is an application or subset of AI. ML focuses on the development


of programs so that it can access data to use it for itself.

The entire process makes observations on data to identify the possible


patterns being formed and make better future decisions as per the
examples provided to them.
The major aim of ML is to allow the systems to learn by themselves
through experience without any kind of human intervention or
assistance.

Deep Learning:
Deep Learning is basically a sub-part of the broader family of Machine
Learning which makes use of Neural Networks(similar to the neurons
working in our brain) to mimic human brain-like behavior.

DL algorithms focus on information processing patterns mechanism


to possibly identify the patterns just like our human brain does and
classifies the information accordingly.

DL works on larger sets of data when compared to ML and the


prediction mechanism is self-administered by machines.

Below is a table of differences between Artificial Intelligence, Machine


Learning and Deep Learning:

Artificial Machine Learning Deep Learning


Intelligence
AI stands for Artificial ML stands for Machine DL stands for Deep
Intelligence, and is Learning, and is the Learning, and is the
basically the study that uses study that makes use of
study/process which statistical methods Neural Networks(similar
enables machines to enabling machines to to neurons present in
mimic human behaviour improve with human brain) to imitate
through particular experience. functionality just like a
algorithm. human brain.
AI is the broader family ML is the subset of AI. DL is the subset of ML.
consisting of ML and DL
as it’s components.
AI is a computer ML is an AI algorithm DL is a ML algorithm that
algorithm which exhibits which allows system to uses deep(more than
intelligence through learn from data. one layer) neural
decision making. networks to analyze
data and provide output
accordingly.
Search Trees and much If you have a clear idea If you are clear about the
complex math is about the logic(math) math involved in it but
involved in AI. involved in behind and don’t have idea about
you can visualize the the features, so you
complex functionalities break the complex
like K-Mean, Support functionalities into
Vector Machines, etc., linear/lower dimension
then it defines the ML features by adding more
aspect. layers, then it defines
the DL aspect.
The aim is to basically The aim is to increase It attains the highest
increase chances of accuracy not caring rank in terms of
success and not much about the success accuracy when it is
accuracy. ratio. trained with large
amount of data.
AI systems can be rule- In reinforcement DL networks consist of
based, knowledge- learning, the algorithm multiple layers of
based, or data-driven. learns by trial and error, interconnected neurons
receiving feedback in that process data in a
the form of rewards or hierarchical manner,
punishments. allowing them to learn
increasingly complex
representations of the
data.
Examples of AI Examples of ML Examples of DL
applications include: applications include: applications include:
Google’s AI-Powered Virtual Personal Sentiment based news
Predictions, Ridesharing Assistants: Siri, Alexa, aggregation, Image
Apps Like Uber and Lyft, Google, etc., Email Spam analysis and caption
Commercial Flights Use and Malware Filtering. generation, etc.
an AI Autopilot, etc.

 How machine learn


A machine learning algorithm works by learning patterns and
relationships from data to make predictions or decisions without
being explicitly programmed for each task.
Here’s a simplified overview of how a typical machine learning
algorithm works:

1. Data Collection

First, relevant data is collected or curated. This data could include


examples, features, or attributes that are important for the task at
hand, such as images, text, numerical data, etc.

2. Data Preprocessing

Before feeding the data into the algorithm, it often needs to be


preprocessed. This step may involve cleaning the data (handling
missing values, outliers), transforming the data (normalization,
scaling), and splitting it into training and test sets.

3. Choosing a Model

Depending on the task (e.g., classification, regression, clustering), a


suitable machine learning model is chosen. Examples include decision
trees, neural networks, support vector machines, and more advanced
models like deep learning architectures.

4. Training the Model

The selected model is trained using the training data. During training,
the algorithm learns patterns and relationships in the data. This
involves adjusting model parameters iteratively to minimize the
difference between predicted outputs and actual outputs (labels or
targets) in the training data.

5. Evaluating the Model

Once trained, the model is evaluated using the test data to assess its
performance. Metrics such as accuracy, precision, recall, or mean
squared error are used to evaluate how well the model generalizes to
new, unseen data.
6. Fine-tuning

Models may be fine-tuned by adjusting hyperparameters (parameters


that are not directly learned during training, like learning rate or
number of hidden layers in a neural network) to improve
performance.

7. Prediction or Inference

Finally, the trained model is used to make predictions or decisions on


new data. This process involves applying the learned patterns to new
inputs to generate outputs, such as class labels in classification tasks
or numerical values in regression tasks.

 Types of Machine Learning


There are several types of machine learning, each with special
characteristics and applications. Some of the main types of machine
learning algorithms are as follows:

1. Supervised Machine Learning


2. Unsupervised Machine Learning
3. Semi – Supervised Machine Learning
4. Reinforcement Learning

1. Supervised Machine Learning


Supervised Learning is defined as when a model gets trained on a
“Labelled Dataset”. Labelled datasets have both input and output
parameters.

In Supervised Learning algorithms learn to map points between inputs


and correct outputs. It has both training and validation datasets
labelled.
Let’s understand it with the help of an example.

Example: Consider a scenario where you have to build an image


classifier to differentiate between cats and dogs. If you feed the
datasets of dogs and cats labelled images to the algorithm, the
machine will learn to classify between a dog or a cat from these
labeled images. When we input new dog or cat images that it has
never seen before, it will use the learned algorithms and predict
whether it is a dog or a cat. This is how supervised learning works, and
this is particularly an image classification.

There are two main categories of supervised learning that are


mentioned below:

 Classification

 Regression
Classification

Classification deals with predicting categorical target variables, which


represent discrete classes or labels. For instance, classifying emails as
spam or not spam, or predicting whether a patient has a high risk of
heart disease. Classification algorithms learn to map the input
features to one of the predefined classes.

Regression

Regression, on the other hand, deals with predicting continuous


target variables, which represent numerical values. For example,
predicting the price of a house based on its size, location, and
amenities, or forecasting the sales of a product. Regression algorithms
learn to map the input features to a continuous numerical value.

Advantages of Supervised Machine Learning

 Supervised Learning models can have high accuracy as they are


trained on labelled data.

 The process of decision-making in supervised learning models is


often interpretable.

 It can often be used in pre-trained models which saves time and


resources when developing new models from scratch.

Disadvantages of Supervised Machine Learning

 It has limitations in knowing patterns and may struggle with


unseen or unexpected patterns that are not present in the
training data.

 It can be time-consuming and costly as it relies on labeled data


only.

 It may lead to poor generalizations based on new data.


Applications of Supervised Learning

Supervised learning is used in a wide variety of applications, including:

 Image classification: Identify objects, faces, and other features


in images.

 Natural language processing: Extract information from text,


such as sentiment, entities, and relationships.

 Speech recognition: Convert spoken language into text.

 Recommendation systems: Make personalized


recommendations to users.

 Predictive analytics: Predict outcomes, such as sales, customer


churn, and stock prices.

 Medical diagnosis: Detect diseases and other medical


conditions.

 Fraud detection: Identify fraudulent transactions.

 Autonomous vehicles: Recognize and respond to objects in the


environment.

 Email spam detection: Classify emails as spam or not spam.

 Quality control in manufacturing: Inspect products for defects.

 Credit scoring: Assess the risk of a borrower defaulting on a loan.

 Gaming: Recognize characters, analyze player behavior, and


create NPCs.

 Customer support: Automate customer support tasks.

 Weather forecasting: Make predictions for temperature,


precipitation, and other meteorological parameters.
 Sports analytics: Analyze player performance, make game
predictions, and optimize strategies.

2. Unsupervised Machine Learning


Unsupervised learning is a type of machine learning technique in
which an algorithm discovers patterns and relationships
using unlabeled data.
Unlike supervised learning, unsupervised learning doesn’t involve
providing the algorithm with labeled target outputs.
The primary goal of Unsupervised learning is often to discover hidden
patterns, similarities, or clusters within the data, which can then be
used for various purposes, such as data exploration, visualization,
dimensionality reduction, and more.

Let’s understand it with the help of an example.

Example: Consider that you have a dataset that contains information


about the purchases you made from the shop. Through clustering, the
algorithm can group the same purchasing behavior among you and
other customers, which reveals potential customers without
predefined labels. This type of information can help businesses get
target customers as well as identify outliers.

There are two main categories of unsupervised learning that are


mentioned below:

 Clustering

 Association

Clustering

Clustering is the process of grouping data points into clusters based


on their similarity. This technique is useful for identifying patterns and
relationships in data without the need for labeled examples.

Association

Association rule learning is a technique for discovering relationships


between items in a dataset. It identifies rules that indicate the
presence of one item implies the presence of another item with a
specific probability.

Advantages of Unsupervised Machine Learning

 It helps to discover hidden patterns and various relationships


between the data.

 Used for tasks such as customer segmentation, anomaly


detection, and data exploration.

 It does not require labeled data and reduces the effort of data
labeling.

Disadvantages of Unsupervised Machine Learning

 Without using labels, it may be difficult to predict the quality of


the model’s output.
 Cluster Interpretability may not be clear and may not have
meaningful interpretations.

 It has techniques such as autoencoders and dimensionality


reduction that can be used to extract meaningful features from
raw data.

Applications of Unsupervised Learning

Here are some common applications of unsupervised learning:

 Clustering: Group similar data points into clusters.

 Anomaly detection: Identify outliers or anomalies in data.

 Recommendation systems: Suggest products, movies, or


content to users based on their historical behavior or
preferences.

 Topic modeling: Discover latent topics within a collection of


documents.

 Image and video compression: Reduce the amount of storage


required for multimedia content.

 Data preprocessing: Help with data preprocessing tasks such as


data cleaning, imputation of missing values, and data scaling.

 Market basket analysis: Discover associations between


products.

 Image segmentation: Segment images into meaningful regions.

 Customer behavior analysis: Uncover patterns and insights for


better marketing and product recommendations.

 Exploratory data analysis (EDA): Explore data and gain insights


before defining specific tasks.
3. Semi-Supervised Learning:
Semi-Supervised Learning is a machine learning algorithm that works
between the supervised and unsupervised learning so it uses both
labelled and unlabelled data.

It’s particularly useful when obtaining labeled data is costly, time-


consuming, or resource-intensive. This approach is useful when the
dataset is expensive and time-consuming. Semi-supervised learning is
chosen when labeled data requires skills and relevant resources in
order to train or learn from it.

We use these techniques when we are dealing with data that is a little
bit labeled and the rest large portion of it is unlabeled.

We can use the unsupervised techniques to predict labels and then


feed these labels to supervised techniques. This technique is mostly
applicable in the case of image data sets where usually all images are
not labeled.
Let’s understand it with the help of an example.

Example: Consider that we are building a language translation model,


having labeled translations for every sentence pair can be resources
intensive. It allows the models to learn from labeled and unlabeled
sentence pairs, making them more accurate. This technique has led to
significant improvements in the quality of machine translation
services.

Advantages of Semi- Supervised Machine Learning

 It leads to better generalization as compared to supervised


learning, as it takes both labeled and unlabeled data.

 Can be applied to a wide range of data.

Disadvantages of Semi- Supervised Machine Learning

 Semi-supervised methods can be more complex to implement


compared to other approaches.

 It still requires some labeled data that might not always be


available or easy to obtain.

 The unlabeled data can impact the model performance


accordingly.

Applications of Semi-Supervised Learning

Here are some common applications of semi-supervised learning:

 Image Classification and Object Recognition: Improve the


accuracy of models by combining a small set of labeled images
with a larger set of unlabeled images.

 Natural Language Processing (NLP): Enhance the performance


of language models and classifiers by combining a small set of
labeled text data with a vast amount of unlabeled text.
 Speech Recognition: Improve the accuracy of speech
recognition by leveraging a limited amount of transcribed
speech data and a more extensive set of unlabeled audio.

 Recommendation Systems: Improve the accuracy of


personalized recommendations by supplementing a sparse set
of user-item interactions (labeled data) with a wealth of
unlabeled user behavior data.

 Healthcare and Medical Imaging: Enhance medical image


analysis by utilizing a small set of labeled medical images
alongside a larger set of unlabeled images.

4. Reinforcement Machine Learning


Reinforcement Machine Learning algorithm is a learning method that
interacts with the environment by producing actions and discovering
errors.
Trial, error, and delay are the most relevant characteristics of
reinforcement learning.
In this technique, the model keeps on increasing its performance using
Reward Feedback to learn the behavior or pattern.
These algorithms are specific to a particular problem e.g. Google Self
Driving car, AlphaGo where a bot competes with humans and even
itself to get better and better performers in Go Game. Each time we
feed in data, they learn and add the data to their knowledge which is
training data. So, the more it learns the better it gets trained and
hence experienced.
Let’s understand it with the help of examples.

Example: Consider that you are training an AI agent to play a game like
chess. The agent explores different moves and receives positive or
negative feedback based on the outcome. Reinforcement Learning
also finds applications in which they learn to perform tasks by
interacting with their surroundings.

Types of Reinforcement Machine Learning

There are two main types of reinforcement learning:

Positive reinforcement

 Rewards the agent for taking a desired action.

 Encourages the agent to repeat the behavior.

 Examples: Giving a treat to a dog for sitting, providing a point in


a game for a correct answer.

Negative reinforcement
 Removes an undesirable stimulus to encourage a desired
behavior.

 Discourages the agent from repeating the behavior.

 Examples: Turning off a loud buzzer when a lever is


pressed, avoiding a penalty by completing a task.

Advantages of Reinforcement Machine Learning

 It has autonomous decision-making that is well-suited for tasks


and that can learn to make a sequence of decisions, like robotics
and game-playing.

 This technique is preferred to achieve long-term results that are


very difficult to achieve.

 It is used to solve a complex problems that cannot be solved by


conventional techniques.

Disadvantages of Reinforcement Machine Learning

 Training Reinforcement Learning agents can be computationally


expensive and time-consuming.

 Reinforcement learning is not preferable to solving simple


problems.

 It needs a lot of data and a lot of computation, which makes it


impractical and costly.

Applications of Reinforcement Machine Learning

Here are some applications of reinforcement learning:

 Game Playing: RL can teach agents to play games, even complex


ones.

 Robotics: RL can teach robots to perform tasks autonomously.


 Autonomous Vehicles: RL can help self-driving cars navigate and
make decisions.

 Healthcare: RL can be used to optimize treatment plans and drug


discovery.

 Natural Language Processing (NLP): RL can be used in dialogue


systems and chatbots.

 Finance and Trading: RL can be used for algorithmic trading.

 Supply Chain and Inventory Management: RL can be used to


optimize supply chain operations.

 Game AI: RL can be used to create more intelligent and adaptive


NPCs in video games.

 Industrial Control: RL can be used to optimize industrial


processes.

 Education: RL can be used to create adaptive learning systems.

 Agriculture: RL can be used to optimize agricultural operations.

You might also like