Unit 1 Machine learning aktu
Unit 1 Machine learning aktu
Learning, in a broad sense, refers to the process of acquiring new knowledge, skills, behaviours, or
understanding through experience, study, or teaching. It is a fundamental aspect of human and animal
behaviour, allowing individuals to adapt to their environment and improve their ability to perform
tasks or respond to situations.
Key Aspects of Learning
1. Acquisition of Knowledge or Skills:
o Learning involves the intake of information, concepts, or skills, which can be through
formal education, practice, observation, or even trial and error.
2. Experience and Adaptation:
o Learning is often driven by experiences. As individuals encounter new situations, they
adapt their understanding or behavior based on these experiences. For instance,
learning to ride a bicycle involves adapting to the balance and coordination required
through practice.
3. Retention:
o Learning also involves the ability to retain information over time. This retention allows
individuals to apply previously acquired knowledge or skills to future situations.
4. Behavioral Change:
o Learning can result in changes in behavior. For example, a person who learns the
dangers of touching a hot surface may avoid doing so in the future.
5. Cognitive and Emotional Growth:
o Beyond just acquiring facts or skills, learning also contributes to cognitive and
emotional development, helping individuals understand the world better, solve
problems, and interact effectively with others.
Types of Learning
1. Classical Conditioning
• Definition: A type of associative learning where a neutral stimulus becomes associated with a
meaningful stimulus, leading to a conditioned response.
• Example: Pavlov’s dogs, who learned to salivate at the sound of a bell because they associated
it with food.
2. Operant Conditioning
• Definition: Learning through reinforcement (rewards) and punishment. An organism learns to
associate behaviours with their consequences.
• Example: A rat learning to press a lever to receive food (positive reinforcement) or avoid a
shock (negative reinforcement).
3. Observational Learning (Social Learning)
• Definition: Learning by observing and imitating the behaviour of others.
• Example: A child learning to tie their shoes by watching a parent or sibling.
4. Cognitive Learning
• Definition: Involves the acquisition of knowledge and skills through mental processes such as
thinking, understanding, and problem-solving.
• Example: Learning mathematical concepts through logical reasoning and problem-solving
activities.
5. Implicit Learning
• Definition: Learning that occurs unconsciously and automatically, without the learner being
aware of what they have learned.
• Example: Picking up grammar rules of a language without explicit instruction, simply by
being exposed to it.
6. Explicit Learning
• Definition: Learning that involves conscious awareness of what is being learned, typically
through direct instruction and deliberate practice.
• Example: Learning to drive a car by taking driving lessons and consciously practicing the
skills needed.
7. Experiential Learning
• Definition: Learning through experience, often involving hands-on or practical activities that
allow learners to apply knowledge in real-world situations.
• Example: Medical students learning surgery techniques by practicing on simulations or
cadavers.
8. Machine Learning (Artificial Learning)
• Definition: A type of learning used in artificial intelligence, where algorithms enable machines
to learn from data and make decisions or predictions based on that data.
• Example: A computer program learning to recognize patterns in images to identify objects,
such as facial recognition software.
According to Tom Mitchell “A computer program is said to learn from experience E with respect to
some class of tasks T and performance measure P, if its performance in tasks T, as measured by P,
improves with experience E”.
Components of a Well-Defined Learning Problem
1. Task (T):
o The specific task that the machine learning system is intended to perform. This could
be anything from classifying emails as spam or not spam to predicting the price of a
house.
2. Performance Measure (P):
o The criterion used to evaluate how well the model is performing the task. Common
performance measures include accuracy, precision, recall, F1 score, and mean squared
error (MSE).
3. Experience (E):
o The data or experiences that the model uses to learn. This usually involves a training
dataset, which the model uses to learn patterns and relationships that help it perform
the task.
A well-defined learning problem is typically expressed in the form: Given experience E, improve
performance P on task T.
Example: In Driverless Car, the training data is fed to Algorithm like how to Drive Car in Highway, Busy and
Narrow Street with factors like speed limit, parking, stop at signal etc. After that, a Logical and Mathematical
model is created on the basis of that and after that, the car will work according to the logical model. Also, the
more data the data is fed the more efficient output is produced.
3. Choose a Model
o Algorithm Selection: Choose an appropriate machine learning algorithm based on the
problem type (classification, regression, clustering, etc.) and the nature of the data.
o Model Complexity: Consider the complexity of the model, balancing between
underfitting (too simple) and overfitting (too complex). Techniques like regularization
can help manage this balance.
4. Train the Model
o Split Data: Divide the data into training, validation, and test sets to evaluate the
model's performance at different stages.
o Model Training: Use the training data to teach the model, adjusting its parameters to
minimize error or maximize the chosen performance metric.
o Hyperparameter Tuning: Optimize the model’s hyperparameters (e.g., learning rate,
number of layers in a neural network) using techniques like grid search or random
search on the validation set.
5. Evaluate the Model
o Validation: Evaluate the model on the validation set to check for overfitting or
underfitting. Make necessary adjustments based on this feedback.
o Testing: Once satisfied with the model, evaluate its performance on the test set to get
an unbiased estimate of how it will perform on new, unseen data.
o Performance Metrics: Calculate and analyze the performance metrics (e.g., accuracy,
precision, recall, F1 score) to assess how well the model meets the problem’s
objectives.
4. Computational Complexity
• Training Time: Some machine learning models, especially deep learning models, require
significant computational resources and time to train, which can be a barrier for many
practitioners.
• Scalability: As datasets grow in size, both in terms of samples and features, the computational
requirements for training and deploying models increase dramatically.
• Resource Constraints: Deploying machine learning models in resource-limited
environments, such as mobile devices or edge computing, requires careful optimization.
5. Generalization
• Domain Adaptation: Models trained on data from one domain may not generalize well to
another domain, a problem known as domain shift. This issue is common when there are
differences in the data distribution between the training and test datasets.
• Transfer Learning: While transfer learning aims to apply knowledge from one domain to
another, it’s not always straightforward and can result in performance degradation if the
domains are too different.
6. Ethical and Privacy Concerns
• Data Privacy: Machine learning models often require large amounts of personal data, raising
concerns about data privacy and security. Ensuring compliance with regulations like GDPR is
crucial.
• Ethical Use: The potential misuse of machine learning models, such as in surveillance or
autonomous weapons, raises significant ethical questions.
Concept Learning
In machine learning (ML), concept learning refers to the ability of an algorithm to learn a generalized
concept from given examples. It involves identifying patterns and categories from data so the system
can correctly classify new, unseen examples. In this context, concepts are usually represented by a set
of features or attributes, and the goal is to infer a model that defines a category or class from these
features.
Note: A hypothesis refers to a candidate function or model that the algorithm uses to map inputs
(features) to outputs (predictions). It is essentially an educated guess that the learning algorithm makes
about the relationship between the input data and the target output.
Find-S Algorithm:
The find-S algorithm is a basic concept learning algorithm in machine learning. The find-S algorithm finds the
most specific hypothesis that fits all the positive examples. We have to note here that the algorithm considers
only those positive training example. The find-S algorithm starts with the most specific hypothesis and
generalizes this hypothesis each time it fails to classify an observed positive training data. Hence, the Find-S
algorithm moves from the most specific hypothesis to the most general hypothesis.
Important Representation:
1. ? indicates that any value is acceptable for the attribute.
2. specify a single required value (e.g., Cold) for the attribute.
3. Φ indicates that no value is acceptable.
4. The most general hypothesis is represented by: {?, ?, ?, ?, ?, ?}
5. The most specific hypothesis is represented by: {ϕ, ϕ, ϕ, ϕ, ϕ, ϕ}
Steps Involved in Find-S:
1. Start with the most specific hypothesis.
2. h = {ϕ, ϕ, ϕ, ϕ, ϕ, ϕ}
3. Take the next example and if it is negative, then no changes
occur to the hypothesis.
4. If the example is positive and we find that our initial
hypothesis is too specific then we update our current
hypothesis to a general condition.
5. Keep repeating the above steps till all the training examples
are complete.
6. After we have completed all the training examples we will
have the final hypothesis when can use to classify the new
examples.
Example:
Consider the following data set having the data about which particular seeds are poisonous.
First, we consider the hypothesis to be a more specific hypothesis. Hence, our hypothesis would be:
h = {ϕ, ϕ, ϕ, ϕ, ϕ, ϕ}
Consider example 1:
The data in example 1 is {GREEN, HARD, NO, WRINKLED}. We see that our initial hypothesis is
more specific and we have to generalize it for this example. Hence, the hypothesis becomes:
h = {GREEN, HARD, NO, WRINKLED}
Consider example 2:
Here we see that this example has a negative outcome. Hence, we neglect this example and our
hypothesis remains the same.
h = {GREEN, HARD, NO, WRINKLED}
Consider example 3:
Here we see that this example has a negative outcome. Hence, we neglect this example and our
hypothesis remains the same.
h = {GREEN, HARD, NO, WRINKLED}
Consider example 3:
Here we see that this example has a negative outcome. Hence, we neglect this example and our
hypothesis remains the same.
h = {GREEN, HARD, NO, WRINKLED}
Consider example 4:
The data present in example 4 is {ORANGE, HARD, NO, WRINKLED}. We compare every single
attribute with the initial data and if any mismatch is found we replace that particular attribute with a
general case (”?”). After doing the process the hypothesis becomes:
h = {?, HARD, NO, WRINKLED }
Consider example 5:
The data present in example 5 is {GREEN, SOFT, YES, SMOOTH}. We compare every single
attribute with the initial data and if any mismatch is found we replace that particular attribute with a
general case (”?”). After doing the process the hypothesis becomes:
h = {?, ?, ?, ? }
Since we have reached a point where all the attributes in our hypothesis have the general condition,
example 6 and example 7 would result in the same hypothesizes with all general attributes.
h = {?, ?, ?, ?}
Hence, for the given data the final hypothesis would be:
Final Hyposthesis: h = {?, ?, ?, ? }
To understand it from scratch let’s have a look at all the terminologies involved,
Hypothesis:
It is usually represented with an ‘h’. In supervised machine learning, a hypothesis is a function that
best characterizes the target.
Specific Hypothesis:
If a hypothesis, h, covers none of the negative cases and there is no other hypothesis, h′, that covers
none of the negative examples, then h is strictly more general than h′, then h is said to be the most
specific hypothesis.
Before understanding version space, let’s first have a look at the formal definition for ‘Consistent’ =>
If and only if h(x) = c(x) for each example (x, c(x)) in D, a hypothesis h is consistent with a collection
of training examples D.
Let’s take our Enjoy Sport example yet again, to understand what Consistent Hypothesis means better,
But, h(x)!= c(x) in the case of training example (3). As a result, hypothesis h1 is not consistent with
the training data set.
Version Space:
With regard to hypothesis space H and training examples D, the version space, denoted as VSH,D, is
the subset of hypotheses from H that are consistent with the training instances in D.
In the above example, We have two hypotheses from H in the case above, both of which are consistent
with the training dataset.
As more instances are observed, the version space of candidate hypotheses reduces, until ideally just
one hypothesis exists that is compatible with all of the observed cases.
Inductive bias
Inductive bias is a fundamental concept in machine learning and refers to the set of assumptions a
learning algorithm makes to generalize from training data to unseen data. Essentially, it's the prior
knowledge that guides the algorithm in making predictions when it encounters new, unseen instances.