Nothing Special   »   [go: up one dir, main page]

ML Unit-1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

ML

UNIT 1
Introduction: Learning -Types of Machine Learning -Supervised Learning -The Brain and the Neuron -
Design a Learning System -Perspectives and Issues in Machine Learning-Concept Learning Task -Concept
Learning as Search -Finding a Maximally Specific Hypothesis-Version Spaces and the Candidate
Elimination Algorithm -Linear Discriminants -Perceptron-Linear Separability-Linear Regression.

PART A
1.Define Machine learning?

A.Machine learning is a subfield of artificial intelligence (AI) that focuses on the development of
algorithms and models that enable computers or machines to learn and make predictions or decisions
without being explicitly programmed. It involves the use of statistical techniques and computational
algorithms to analyze and interpret large amounts of data, allowing machines to recognize patterns,
make data-driven predictions, and improve their performance over time.

Machine learning techniques can be broadly categorized into three main types:-

 Supervised Learning
 Unsupervised Learning
 Reinforcement Learning

2. What is role of neuron in artificial intelligence?

A. In artificial intelligence, specifically in the field of neural networks and deep learning, a neuron is a
fundamental building block that mimics the behavior of biological neurons found in the human brain.
Neurons play a crucial role in enabling artificial neural networks to learn and make predictions or
decisions.

A neuron, also known as a perceptron, receives one or more input signals, performs a computation on
them, and produces an output signal. The inputs are weighted by a set of parameters called weights,
which determine the significance or contribution of each input to the neuron’s output. Additionally, each
neuron has a bias term that can be thought of as a threshold for activation.

3.What is Supervised Learning? Give Example?

A. Supervised learning is a machine learning approach in which the algorithm learns from labeled
training data, where each data point is associated with a corresponding target or output value. The goal
is for the algorithm to learn the underlying patterns and relationships between the input data (features)
and the desired output.

Ex:-

Let’s say you want to develop a spam email classifier. You have a dataset of emails, where each email is
labeled as either “spam” or “not spam.” The emails serve as the input data, and the labels ("spam" or
"not spam") represent the desired output.
Using supervised learning, you can train a classification algorithm, such as a logistic regression model or
a support vector machine (SVM), on this labeled dataset. The algorithm learns the patterns and
characteristics of spam and non-spam emails by analyzing features like the subject line, sender, and
content of the emails. It maps these features to the corresponding labels (spam or not spam).

The model will then predict whethe” each email is spam or not spam based on its learned knowledge.

4.Discuss the concept of linear separability in AI?

A. linear separability is a property of two sets of points. This is most easily visualized in two dimensions
(the Euclidean plane) by thinking of one set of points as being colored blue and the other set of points as
being colored red. These two sets are linearly separable if there exists at least one line in the plane with
all of the blue points on one side of the line and all the red points on the other side. This idea
immediately generalizes to higher-dimensional Euclidean spaces if the line is replaced by a hyperplane.

5.Write a note on reinforced Machine learning?

A. In reinforced machine learning, an agent learns to take actions based on its observations of the
environment and receives feedback in the form of rewards or penalties. The agent's goal is to learn a
policy—a strategy or set of rules—that maximizes the cumulative reward over time.

The key components of reinforced machine learning are as follows:

 Agent: The agent is the learner or decision-maker that interacts with the environment
 Environment: The environment is the external system with which the agent interacts
 Actions: Actions are the decisions made by the agent to influence the environment.
 Rewards: Rewards are the feedback or signals provided by the environment to the agent based
on its actions.

6.What do mean by perceptron?

A. A perceptron is a basic building block of an artificial neural network and is one of the simplest forms
of a single-layer neural network

The perceptron takes one or more input signals, multiplies them by corresponding weights, and
computes their weighted sum.The computed sum is then passed through an activation function, which
introduces non-linearity into the perceptron's output.

In summary, a perceptron is a simple artificial neuron that takes input signals, computes their weighted
sum, applies an activation function, and produces an output. It serves as a basic unit in neural networks

7.What are the limitations of McCulloch & pit Neurons?


A. Only binary inputs and outputs: McCulloch-Pitts neurons can only handle binary inputs and outputs.
This means that they cannot be used to represent real-world data, which is often continuous.

No learning: McCulloch-Pitts neurons do not have any learning capabilities. This means that they cannot
be used to solve problems that require the ability to adapt to new data.

Limited representation power: McCulloch-Pitts neurons can only represent a limited set of functions.
This is because they are only able to implement linear functions.

Lack of Hidden Layers: M-P neurons are single-layer networks without any hidden layers. They can only
perform simple input-output mappings without the ability to learn hierarchical or layered
representations

8.Write about different components of Artificial Neural Networks.

A. The key components of artificial neural networks are:

Neurons (Nodes): Neurons, also known as nodes, are the fundamental units of computation in neural
networks. They receive input signals, perform computations, and produce output signals.

Weights: Weights represent the strength or importance assigned to the connections between neurons.

Activation Function: The activation function determines the output of a neuron based on the weighted
sum of its inputs.

Bias: A bias term is added to each neuron to provide an additional degree of freedom and control over
the activation of the neuron.

Layers: Neural networks consist of multiple layers of interconnected neurons.

Connections: Connections represent the pathways through which signals flow between neurons in a
neural network.

Loss function: The loss function measures the difference between the ANN’s predictions and the actual
labels

Learning Algorithm: The learning algorithm governs how the network adjusts its weights and biases
based on the observed data and the error signal provided by the loss function.

9. What are the various issues in Machine Learning

A. Some of the most common issues in machine learning include:

 Data Quality and Quantity: Machine learning heavily relies on data. The quality and quantity of
data used for training models can greatly impact their performance.
 Overfitting: This occurs when a machine learning model learns the training data too well and
becomes too specific to it. This can lead to the model performing poorly on new data.
 Underfitting: This occurs when a machine learning model does not learn the training data well
enough and is unable to make accurate predictions on new data.
 Scalability: Machine learning models can be computationally expensive to train and deploy. This
can be a challenge for businesses that need to deploy models in real time or at scale.
10. Explain about Version Spaces in Machine Learning.

A. Version space is a concept in machine learning that refers to the set of all possible hypotheses that are
consistent with the training data. The version space is initially large, but it is gradually reduced as more
training data is seen. the final version space contains the single hypothesis that is most likely to be
correct. Version space learning is a powerful technique that can be used to learn a variety of different
types of hypotheses. It is particularly useful for learning hypotheses that are difficult to represent in a
traditional way, such as decision trees.
Part B
1. Compare the Supervised and Unsupervised Learning. Also explain are the various types of
Supervised Learning

A.

Aspect Supervised Learning Unsupervised Learning


Data Labeled data Unlabeled data
Task Complexity Generally easier to define and Can be more challenging as the
understand the task task is often undefined
Goal Predict or classify based on Discover patterns, structures, or
labels relationships
Feedback Receives feedback (labels) No explicit feedback
Types of Learning Classification, regression, Clustering, dimensionality
reduction
Examples Linear regression, decision Clustering, dimensionality
trees, reduction

Types of Supervised Learning:

 Classification: Classification is a type of supervised learning where the goal is to predict the class
or category of an input based on its features.
 Regression: Regression is another type of supervised learning where the goal is to predict a
continuous or numerical value as the output.
 Sequence Labeling: Sequence labeling is a supervised learning task where the goal is to assign
labels to each element in a sequence of data.
 Structured Prediction: Structured prediction involves predicting structured outputs, such as
sequences, trees, or graphs, from input data.

2. Explain the brain and the neuron with respect to AI. Explain the architecture in ANN?

A. The human brain is made up of billions of neurons, which are the basic units of computation. Neurons
are interconnected by synapses, which allow them to pass signals to each other. The way that neurons
communicate and interact with each other is what gives the brain its ability to learn and process
information.

Artificial neural networks (ANNs) are inspired by the structure and function of the human brain. ANNs
are made up of nodes, which are similar to neurons, and edges, which are similar to synapses. Nodes in
an ANN receive inputs from other nodes and then process those inputs to produce an output. The
outputs from one layer of nodes can then be passed to the next layer of nodes, and so on

Artificial Neural Network (ANN) Architecture:

The most common architecture in ANNs is the feedforward architecture, where the information flows in
one direction, from the input layer to the output layer, without any loops or feedback connections. The
input layer receives the raw input data, the hidden layers process intermediate computations, and the
output layer produces the final predictions or decisions.
There are several key components and concepts in the architecture of an ANN:

 Input Layer: The input layer is the first layer of the neural network, which receives the input
data.
 Hidden Layers: Hidden layers are the intermediate layers between the input and output layers.
They perform computations and extract progressively more abstract and complex features from
the input data.
 Output Layer: The output layer is the final layer of the neural network, which produces the
predicted outputs or decisions based on the computations performed by the preceding layers.
 Connections and Weights: Neurons in different layers are connected through weighted
connections. Each connection between neurons has an associated weight, which determines the
strength.
 Activation Functions: Activation functions introduce non-linearity into the network's
computations.
 Bias: Each neuron typically has an associated bias term, which acts as an offset or threshold for
activation.

3. Explain the types of Machine Learning?

A. There are three main types of machine learning: supervised learning, unsupervised learning, and
reinforcement learning.

Supervised learning: it is the most common type of machine learning. In supervised learning, the
machine learning model is trained on a set of labeled data. The labeled data consists of input data and
the desired output data. The machine learning model learns to map the input data to the desired output
data.

Ex:

 Classification: Predicting whether an email is spam or not.


 Regression: Predicting the price of a house.

Unsupervised learning: it is a type of machine learning in which the machine learning model is not given
any labeled data. The machine learning model learns to find patterns in the data without any guidance.
Unsupervised learning is often used for tasks such as clustering and dimensionality reduction.

Ex:

 Clustering: Grouping data points together based on their similarity.


 Dimensionality reduction: Reducing the number of features in a dataset without losing too
much information.

Reinforcement learning: it is a type of machine learning in which the machine learning model learns by
trial and error. The machine learning model is given a reward for taking actions that lead to desired
outcomes. The machine learning model learns to take actions that maximize the reward.

Ex:

 Playing games: Learning to play games like chess or Go.


 Robotics: Learning to control robots in a dynamic environment.

4. Discuss linear separability and linear regression?

A. Linear separability is a property of a set of data points. A set of data points is linearly separable if
there exists a linear function that can separate the data points into two or more classes. For example,
the set of data points below is linearly separable by a line, because all of the blue points are on one side
of the line and all of the red points are on the other side.

Linear regression is a statistical method that is used to model the relationship between a dependent
variable and one or more independent variables. The dependent variable is the variable that we are
trying to predict, and the independent variables are the variables that we are using to make the
prediction. For example, we could use linear regression to predict the price of a house based on the size
of the house, the number of bedrooms, and the location of the house.

In linear regression, the relationship between the dependent variable and the independent variables is
modeled by a linear function. This means that the predicted value of the dependent variable can be
calculated by a simple equation that includes the independent variables.

Linear separability can be used to solve classification problems, while linear regression can be used to
solve regression problems.

Linear separability requires the data to be linearly separable, while linear regression does not require the
data to be linearly separable.

5. Describe the biological neuron in AI?

A. In artificial intelligence (AI), the biological neuron serves as a fundamental inspiration for the design of
artificial neurons or nodes in artificial neural networks (ANNs). Let's explore the key components and
functionality of a biological neuron and its relation to AI:

Structure of a Biological Neuron:

A biological neuron consists of several essential components, including:

Cell Body (Soma): The cell body is the central part of the neuron that contains the nucleus and other
vital components responsible for maintaining the neuron's functions.

Dendrites: Dendrites are branch-like structures extending from the cell body. They receive signals or
inputs from other neurons or sensory receptors and transmit these signals towards the cell body.

Axon: The axon is a long, slender extension arising from the cell body. It transmits electrical signals called
action potentials away from the cell body towards other neurons or target cells.
Synapses: Synapses are specialized junctions between neurons where the axon terminal of one neuron
connects with the dendrites or cell body of another neuron. Synapses facilitate the transmission of
signals from one neuron to another through chemical or electrical means.

6. What is linear Separability? Give example on And Gate?

A. In machine learning, linear separability is a property of a set of data points. A set of data points is
linearly separable if there exists a linear function that can separate the data points into two or more
classes. For example, the set of data points below is linearly separable by a line, because all of the blue
points are on one side of the line and all of the red points are on the other side.

An AND gate is a logical gate that takes two binary inputs (0 or 1) and produces a binary output based on
the AND operation. The AND gate outputs 1 only when both inputs are 1; otherwise, it outputs 0.

Let's consider an example of an AND gate with two input features, x1 and x2, and the corresponding
output, y:

x1 x1 y
0 0 0
0 1 0
1 0 0
1 1 1

In this example, the inputs x1 and x2 represent the binary values, and y represents the output of the
AND gate. We can plot these data points in a two-dimensional space, where x1 and x2 are the two axes.

If we represent 0 as one type of data point (e.g., a circle) and 1 as another type of data point (e.g., a
cross), we can observe that the data points for y = 0 form a cluster in the bottom left corner, while the
data point for y = 1 is a single point in the top right corner.
By drawing a straight line, in this case, the diagonal from the bottom left to the top right, we can
perfectly separate the data points of different classes. All data points with y = 0 lie on one side of the
line, and the data point with y = 1 lies on the other side. This demonstrates that the data points of the
AND gate are linearly separable.

7. What is regression in Machine Learning.

A. In machine learning, regression is a supervised learning technique that models the relationship
between a dependent variable and one or more independent variables. The dependent variable is the
variable that we are trying to predict, and the independent variables are the variables that we are using
to make the prediction. For example, we could use regression to predict the price of a house based on
the size of the house, the number of bedrooms, and the location of the house.

In regression, the relationship between the dependent variable and the independent variables is
modeled by a mathematical function. This function can be linear or non-linear. Linear regression is the
simplest form of regression, and it models the relationship between the dependent variable and the
independent variables using a straight line. Non-linear regression models can be more complex, and they
can be used to model relationships that are not linear.

There are many different types of regression models, but some of the most common types include:

 Simple linear regression: Simple linear regression is a model that has one independent variable.
 Multiple linear regression: Multiple linear regression is a model that has more than one
independent variable.
 Logistic regression: Logistic regression is a model that is used to predict a binary outcome, such
as whether or not someone will buy a product.
 Poisson regression: Poisson regression is a model that is used to predict a count outcome, such
as the number of people who will visit a website in a day

Some examples include:

Predicting House Prices: Given features such as the size, number of rooms, location, and other relevant
factors, regression can be used to predict the price of a house

Stock Market Forecasting: Regression models can analyze historical stock market data, such as price
movements, trading volume, and economic indicators, to predict future stock prices.

Medical Diagnosis: Regression can be used to predict disease progression, estimate patient health
outcomes, or determine the likelihood of specific medical conditions based on patient characteristics
and medical history.

8. Describe Perceptron for OR function

A. To describe a perceptron for the OR function, let's consider a simple scenario where we have two
binary input features, x1 and x2, and the target variable y represents the OR function of these inputs.
The OR function outputs 1 if at least one of the inputs is 1, and it outputs 0 only if both inputs are 0.

Here's how we can design a perceptron to learn the OR function:


 Input Values: Let's assume our training data consists of the following input-output pairs:
(0, 0) -> 0
(0, 1) -> 1
(1, 0) -> 1
(1, 1) -> 1

Weight Initialization:

 We initialize the weights w1 and w2 to small random values, such as 0.1 and 0.2.
 We also set the bias term, b, to a random small value, like 0.3.

Activation Function:

 For this example, we can use a step function as the activation function. It returns 1 if the
weighted sum plus the bias is greater than or equal to 0, and it returns 0 otherwise.

Learning Algorithm:

 We can use the perceptron learning algorithm, also known as the delta rule to update the
weights and bias iteratively until the model converges or reaches a predefined stopping criteria.
 The update rule is:
w1 = w1 + η * (target - output) * x1
w2 = w2 + η * (target - output) * x2
b = b + η * (target - output)
 In the update rule, η is the learning rate, target is the desired output, output is the predicted
output, and x1 and x2 are the input features.

Training Process:

 We iterate through the training data and update the weights and bias according to the learning
algorithm until the model converges or the stopping criteria are met.
 During each iteration, we compute the weighted sum of the inputs plus the bias, pass it through
the step activation function, and compare the output with the target.
 If the predicted output matches the target, no updates are performed. Otherwise, the weights
and bias are adjusted according to the learning rule.

Testing:

 Once the perceptron is trained, we can test its performance by providing new input
combinations.
 The perceptron should now be able to correctly predict the OR function for unseen input
combinations.

9. Write the learning algorithm for perceptron and limitations of perceptron.

A. The learning algorithm for a perceptron is as follows:

1. Initialize the weights of the perceptron to random values.


2. Present the perceptron with a training data point.
3. Calculate the output of the perceptron.
4. If the output of the perceptron is not the same as the desired output, adjust the weights of the
perceptron.
5. Repeat steps 2-4 until the perceptron can correctly classify all of the training data.

The perceptron will continue to adjust its weights until the cost function is minimized. This means that
the perceptron will eventually learn to correctly classify all of the training data.

The limitations of a perceptron include:

 It can only learn linearly separable data. This means that the data must be able to be separated
by a straight line. If the data is not linearly separable, the perceptron will not be able to learn it.
 It is not very powerful. Perceptrons are simple models, and they can only learn simple tasks. For
more complex tasks, more powerful models are needed.
 It is not very interpretable. It is difficult to understand how a perceptron makes its decisions. This
can make it difficult to use perceptrons in applications where it is important to understand how
the decisions are made.

10. Explain the concept of Version Spaces and the Candidate Elimination Algorithm with proper
example. How is this algorithm used in machine learning.

A. Version space is a concept in machine learning that is used to represent the set of all possible
hypotheses that are consistent with a given set of training data. A hypothesis is a statement about the
relationship between the features and the target variable in a dataset. For example, a hypothesis for a
classification problem might be that "if the feature x is greater than 0, then the target variable y is equal
to 1."

The candidate elimination algorithm is a machine learning algorithm that can be used to find the
hypothesis that best fits a given set of training data. The algorithm works by starting with a version space
that contains all possible hypotheses. The algorithm then iteratively eliminates hypotheses from the
version space until it is left with a single hypothesis.

Let's say we have a set of training data that consists of the following data points:

Data Point Feature x Target variable y


1 1 1
2 2 1
3 3 1
4 4 0
5 5 0
The version space for this set of training data would initially contain all possible hypotheses. This means
that the version space would contain hypotheses such as "if x is greater than 0, then y is equal to 1" and
"if x is less than 0, then y is equal to 1."

The candidate elimination algorithm would then start to eliminate hypotheses from the version space.
The first hypothesis that would be eliminated is the hypothesis "if x is equal to 0, then y is equal to 1."
This is because this hypothesis is not consistent with the data point where x is equal to 4 and y is equal
to 0.
The next hypothesis that would be eliminated is the hypothesis "if x is greater than 1, then y is equal to
1." This is because this hypothesis is not consistent with the data point where x is equal to 1 and y is
equal to 1.

The algorithm would continue to eliminate hypotheses from the version space until it is left with a single
hypothesis. In this case, the algorithm would be left with the hypothesis "if x is equal to 2, then y is equal
to 1."

The candidate elimination algorithm can be used to find the hypothesis that best fits a given set of
training data. The algorithm is relatively simple to implement and it can be used to solve a variety of
machine learning problems.

A.

You might also like