0% found this document useful (0 votes)
5 views16 pages

Chapter Knowledge in Learning

this is a chapter from ai that consists of learning process of a robot

Uploaded by

yadu swimmer
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)
5 views16 pages

Chapter Knowledge in Learning

this is a chapter from ai that consists of learning process of a robot

Uploaded by

yadu swimmer
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

Knowledge in Learning

What is learning in AI?


Learning in AI refers to the process by which an intelligent system improves its performance
over time by acquiring knowledge or refining existing knowledge based on experience or
new data. The goal of learning is to allow an AI system to make better decisions, perform
tasks more efficiently, and adapt to new situations by generalizing from previous examples
or solving problems.
Types of Learning in AI
1. Rote Learning:
o Rote learning is a simple form of learning where the AI system stores
information and retrieves it when necessary. It doesn't involve any reasoning
or understanding beyond memorization.
o Example 1: A chatbot memorizing frequently asked questions and their
responses without understanding the content.
o Example 2: A pattern recognition system memorizing specific inputs and their
corresponding outputs without generalizing to unseen data.

Rote learning involves memorizing information through repetition without necessarily


understanding the underlying meaning. Here are some rote learning techniques:

1. Read it aloud: Repeating information verbally helps reinforce memory. Saying things
out loud activates auditory memory.
o Example: Reading a poem aloud multiple times to memorize it.
2. Write it down: Writing out the material repeatedly helps with retention through
muscle memory and visual recognition.
o Example: Writing down vocabulary words to memorize their spelling.
3. Sing it out: Turning information into a song or rhythm can help make it more
memorable.
o Example: Singing the alphabet or times tables.
4. Visualize: Creating a mental image or associating information with a visual cue
enhances memory.
o Example: Visualizing a map to remember geographic locations.
5. Free association: Linking new information to things you already know by creating
associations helps recall.
o Example: Associating historical events with vivid imagery or personal
experiences.

These techniques aid in memorization, especially when the material doesn't involve deep
understanding or reasoning.

2. Learning by taking Advice:


o Learning by taking advice refers to the process where an AI or a person learns
how to perform a task by following explicit instructions or rules given by
someone knowledgeable. The learner does not discover strategies through
trial and error but instead applies what has been advised.
o This type of learning occurs when the system acquires knowledge through
direct instructions or advice provided by an external source, such as a human
or another system. The AI doesn't learn from examples or experience, but
rather, from explicit guidelines.
o Example 1: An AI assistant being programmed with specific rules for how to
handle customer service inquiries based on advice from an expert.
o Example 2: A chess-playing AI system receiving advice on opening strategies
directly from a human grandmaster.

Let’s take the example of learning the card game Hearts using First Operational
Operationalizer (FOO), an AI that learns how to play the game by following advice.

Learning Hearts by Taking Advice

 Goal: FOO wants to learn how to play the card game Hearts, but it doesn't know the
rules at first.
 Advice: A human expert provides advice on how to play, such as basic strategies and
rules.

Step 1: Basic Advice (Rules of the Game)

The human expert tells FOO some basic rules:

 Don’t win hearts: FOO is told, "Try not to win any hearts, as each heart card is worth
points, and you want to avoid points."
 Avoid the Queen of Spades: Another piece of advice is, "Don’t win the Queen of
Spades, as she is worth a lot of points."

FOO doesn’t understand the full game yet but applies these basic pieces of advice.

Step 2: Operationalizing the Advice

FOO uses this advice to create simple strategies:

 Avoid Hearts: Whenever it can, FOO will play lower cards so it doesn't win tricks
containing hearts.
 Avoid the Queen of Spades: FOO will avoid playing high spades, especially if the
Queen of Spades could be in play.
Step 3: Learning through Play (Applying Advice)

As FOO plays the game, it follows the advice:

 It looks at its hand and tries to choose cards that will avoid winning hearts or the
Queen of Spades.
 For example, if there’s a heart in the trick, it will play its lowest card to avoid winning
the trick.

Step 4: Refining Strategies Based on Feedback

After several rounds of the game:

 FOO sees that when it follows the advice (not winning hearts or the Queen of
Spades), it tends to score better.
 It learns to prioritize this advice, making adjustments like passing high hearts or
spades to other players.

FOO becomes a better Hearts player simply by operationalizing (putting into practice) the
advice it received. It did not discover these strategies by itself but rather learned by
following instructions.

3. Learning by Problem Solving:


o Involves improving performance by solving problems, and adjusting
strategies based on the outcomes. It includes several subtypes:
i. Learning by Parameter Adjustment:
 Learning by Parameter Adjustment refers to a learning process in AI
where the system improves its performance by adjusting internal
parameters. This is a common approach in machine learning
algorithms, especially those that involve optimization techniques. The
system's performance is measured based on some feedback or error,
and the parameters are tuned to reduce this error and achieve better
results.
 The system learns by adjusting internal parameters, often seen in
systems that rely on optimization techniques (e.g., neural networks).
 Example 1: A neural network adjusts weights during back propagation
to minimize errors in a classification task.
 Example 2: A self-driving car adjusts its steering parameters based on
trial and error while driving in different environments.

Example of Parameter Adjustment in a Self-Driving Car


Another example of learning by parameter adjustment can be seen in self-driving cars. The
goal is to adjust the car's driving behavior (parameters) based on feedback from the
environment (sensor data).

 Scenario: The AI controls the car's steering, braking, and acceleration.


 Parameters: The system's parameters might include how much to turn the steering
wheel when detecting a curve or how aggressively to brake when detecting an
obstacle.
 Learning Process:
1. The system observes data from sensors (cameras, lidar, radar) and takes an
action (e.g., adjusts the steering).
2. It compares the outcome of the action to the desired outcome (e.g., staying
in the center of the lane).
3. It calculates the error (e.g., how far off-center the car is).
4. Using algorithms like Q-learning or deep reinforcement learning, the system
adjusts its parameters (e.g., how sharply to steer) to reduce this error.
 Iterative Improvement: Over time, with enough training examples, the system will
learn to make better driving decisions, keeping the car centered on the road more
consistently.

Learning by parameter adjustment is crucial for many AI systems. In essence, the system
learns by tweaking its internal parameters based on feedback (error or reward) from its
actions. Through iterative updates, the system's performance improves until it can handle
tasks like classification, driving, or playing games with high accuracy.

Example 2: Adjusting Shower Temperature

You want to find the perfect water temperature for your shower, not too hot and not too
cold.

Step 1: Initial Setup

 You turn the knob to an initial position randomly, since you are unsure of the right
setting.
 Let’s say the water is too cold at first.

Step 2: Feedback (Error Detection)

 You feel the water and realize it’s uncomfortable. This is your feedback.
 The error here is the difference between the actual temperature (too cold) and the
desired temperature (just right).

Step 3: Adjusting the Knob (Parameter Adjustment)

 Based on the feedback, you adjust the shower knob slightly towards the hotter side.
 The "knob position" is the parameter that you’re adjusting to improve the outcome.
Step 4: Rechecking and Iterating

 You feel the water again and notice it’s warmer but still not perfect.
 You continue adjusting the knob slightly until you reach the ideal temperature.

Step 5: Learning Over Time

 Over time, after taking several showers, you learn the approximate knob position
that gives the perfect water temperature without much trial and error.
 Now, whenever you take a shower, you can quickly adjust the knob to the right spot,
since you’ve learned the ideal parameter (knob position) through repeated
adjustment.
 The knob position is like the "parameter" in machine learning.
 The feedback (too cold or too hot) is the "error" that tells you how far off you are
from the goal.
 You keep adjusting the parameter (knob) based on feedback until you minimize the
error, just like a learning system tunes its parameters to make better predictions.

This process mirrors how AI systems like neural networks adjust their weights during
training to minimize errors and improve performance.

 Learning by Macro-Operation:
 This involves creating new, higher-level actions (or macro-operators) by
combining existing operations to solve complex tasks more efficiently.
 Example 1: A robotic arm learning to pick up objects by creating a new macro-
operation that combines several basic movements (grasp, lift, and place).
 Example 2: In planning systems, learning a macro-operation that combines
"fetching an object" and "delivering an object" into a single high-level operation
for faster task execution.

STRIPS algorithm Example

 Learning by Chunking:

o Chunking refers to the process of combining small pieces of knowledge or


actions into a single "chunk" to reduce complexity and improve problem-
solving.
o Example 1: A chess AI learns to chunk sequences of moves that lead to
common tactical patterns, like a fork or a checkmate, improving decision-
making.
o Example 2: A math tutor AI system chunks arithmetic operations like
"multiplying by 10" as a single unit, making it faster to solve certain
problems.
o Example 3: A language model learns to chunk words together into phrases
and sentences, improving its ability to generate grammatically correct text.
o Example 4: A chess AI chunks common sequences of moves like opening
strategies (e.g., the Ruy-Lopez opening) into a single operation, allowing it to
make decisions more quickly

Soar Example:

 Utility Problem:

o This refers to the challenge that arises when too many learned chunks or
rules make the system inefficient because it takes longer to find the relevant
rule. The AI must balance between having useful chunks and avoiding too
many irrelevant ones.
o Example 1: A decision-making system becomes slower as it accumulates
many rules that it must search through, even though only a few of those rules
are helpful for the current problem.
o Example 2: In a robot's learning process, the robot learns many irrelevant
actions, making it inefficient to find the most useful action in specific
situations.

Prodigy program:

 Learning from Example (Induction Learning):

 Induction learning involves learning general rules or patterns from specific examples.
The AI system is provided with a set of examples, and it induces a general rule or
model that can be applied to new data.
 Example 1: A decision tree algorithm that learns a classification rule by analysing
labelled training data (e.g., a set of medical cases and their corresponding
diagnoses).
 Example 2: A machine learning model learns to recognize cats in images by being
trained on a dataset of images labelled as "cat" or "not cat."
 Example 3: A spam email filter learns to classify emails as spam or not spam based
on a training dataset containing examples of both types of emails. It induces general
patterns from the examples and applies them to new, unseen emails.
 Example 4: A supervised learning algorithm learns to classify images of animals (e.g.,
cats, dogs, birds) by analyzing a labeled dataset of animal images and inducing a
model that can predict the correct label for new images.

Classification refers to the process where an AI system or algorithm learns to assign labels
or categories to new data based on examples it has seen during training. This is a type of
supervised learning, where the system is given input-output pairs (examples) and learns to
map new inputs to their correct outputs.
Example of Classification: Email Spam Detection
Let’s consider a simple example: Email Spam Classification.
Training Phase (Learning from Examples):
 The AI system is trained on a dataset containing examples of emails. Each email is
labeled as either "Spam" or "Not Spam".
 The inputs to the system could be features extracted from the emails, such as:
o Number of links in the email.
o Presence of certain keywords (e.g., "free," "winner").
o Whether the email contains attachments.
 The system learns from these examples. For example:
o Emails with many links and words like "free" are often labeled as Spam.
o Emails from familiar contacts or companies are often labeled as Not Spam.
Prediction Phase:
 After training, the system is ready to classify new emails.
 When a new email arrives, the system checks its features and classifies it as Spam or
Not Spam based on the patterns it learned during training.
Winston Learning Program

The Winston Learning Program, developed by Patrick Henry Winston, is an early symbolic AI
program designed to learn structural concepts through examples. It is based on learning by
example and is a form of concept learning where the program builds representations of
complex structures using simpler elements. The program's approach to learning revolves
around creating descriptions of objects or concepts using known patterns and then
adjusting these descriptions as new examples are provided.

The Winston Learning Program represents a fundamental approach to AI learning where


the system builds knowledge by observing examples and refining its concept representation.
By learning from both positive and negative examples, the program can generalize rules and
relationships, allowing it to develop a deeper understanding of the concepts it encounters.
Though symbolic and structural, this early work laid the groundwork for future AI systems
that learn from data in more complex ways.

How Winston's Learning Program Works:

Winston’s program is particularly focused on learning visual concepts, such as the structure
of simple block-world configurations (e.g., recognizing a tower made of blocks or identifying
an arch). The main idea is that the program learns from positive and negative examples,
adjusting its internal concept model by looking for differences between examples that
belong to a concept and those that do not.

Key Components of Winston's Learning Program:

1. Positive Examples:
o The program is given a positive example of the concept. For instance, it might
be shown an arrangement of blocks that form an "arch." The program starts
by noting important relationships between the elements in this example.
2. Negative Examples:
o The program is also shown examples that do not fit the concept. These are
called negative examples. For instance, an arrangement of blocks that does
not form an arch. The program examines what makes this example different
from the positive example.
3. Concept Representation:
o Winston’s program builds its understanding of concepts by creating symbolic
descriptions of objects. For example, it might describe an arch as "a structure
with two vertical blocks and a horizontal block resting on top."
o The program represents each object and its relationships symbolically. These
relationships are often spatial, such as "on top of," "next to," or "below."
4. Generalization and Specialization:
o The program generalizes the concept from the positive example by
identifying the common features that should be present for any object of
that type (e.g., arches always have two side blocks with a top block
connecting them).
o When a negative example is introduced, it specializes the concept by noting
what features must be present for it to remain valid (e.g., an arch can't have
three side blocks or the top block should rest directly on the side blocks).
5. Learning Process:
o The process of learning involves repeatedly modifying the internal concept
representation based on new positive and negative examples.
o If a new positive example of an arch is provided, the program checks if its
current model of an "arch" fits the new example. If it doesn’t, the program
updates its concept by generalizing it to include the new example.
o If a new negative example is given, the program checks what characteristics
prevent this example from fitting the concept, then adjusts the concept by
making it more specific.

Example: Learning an "Arch" in the Block World

Imagine the program is learning the concept of an arch in a world made of blocks. The
process might look like this:

1. Positive Example:
o The program is shown a stack of blocks arranged like an arch: two blocks
standing vertically and a third block resting horizontally across them.
o The program builds a symbolic description:
 Block A is vertical.
 Block B is vertical.
 Block C is horizontal and resting on Blocks A and B.
2. Negative Example:
o The program is shown another stack of blocks, but this one has three vertical
blocks without the horizontal block on top. This does not represent an arch.
o The program identifies what is missing from its concept model and updates it
to ensure that a horizontal block resting on two vertical blocks is necessary
for the structure to be considered an arch.
3. Concept Refinement:
o The program will keep refining the concept as more examples (positive and
negative) are provided, creating a more accurate and generalized
representation of what an arch is.

The method for determining object properties and relations in AI systems typically involves
extracting key features from objects in an image or environment and analysing how these
objects relate to each other spatially or structurally. This method is particularly used in
symbolic AI and machine vision to understand the components and their interactions within
a scene.

Here is a step-by-step explanation, followed by a pictorial depiction.

Steps for Determining Object Properties and Relations:

1. Object Identification (Recognition):


o The first step is recognizing individual objects in the scene or image. This can
involve detecting shapes, edges, and colors. Each object is assigned a label or
identifier based on its characteristics.
o Example: In a block world, the AI recognizes blocks by detecting rectangular
shapes and differentiating them based on size, color, or position.
2. Object Properties:
o Once objects are recognized, their properties are determined. These
properties might include:
 Size: Is the object large or small?
 Colour: What colour is the object?
 Shape: What geometric shape is the object (e.g., rectangular,
circular)?
 Orientation: Is the object standing vertically, lying horizontally, or
tilted?
o Example: A block is recognized as a "red rectangular block" with a certain
height and width.
3. Relationship Identification:
o After determining individual object properties, the system identifies the
relationships between objects. These relationships can include:
 Spatial Relationships: Where objects are located in relation to each
other, such as "on top of," "next to," "below."
 Part-Whole Relationships: Identifying if one object is part of another
larger structure.
 Connectivity: Are objects physically connected or touching?
o Example: One block may be “on top of” another block, forming a stack, or
one block may be “next to” another block.
4. Constructing a Symbolic Representation:
o Based on the properties and relationships, a symbolic representation of the
scene is built. This representation allows the system to describe the structure
and behavior of the scene in terms of objects and their relationships.
o Example: The system might describe an arch as:
 Two vertical blocks, one horizontal block on top, with no space
between the blocks.

Picture Depiction of Object Properties and Relations:

Here’s a visualization of how an AI system might determine the properties and relations of
objects in a simple block world, where we will see two vertical blocks with a horizontal block
on top, forming an "arch."

Here's a depiction of a block world where two vertical blocks are standing side by side, and a
horizontal block rests on top of them, forming an arch. The relationships between the
blocks, such as "on top of" and "next to," are represented visually, along with properties like
size and orientation.

This type of diagram helps in understanding how an AI system determines object properties
and their spatial relationships in scenes like this.
Key Characteristics of Winston's Learning Program:

 Symbolic Representation: The program uses symbols to represent objects,


relationships, and structures. This symbolic approach allows the system to
manipulate and modify concepts in a structured way.
 Learning from Examples: The program learns by observing examples that either
match or don’t match a particular concept. It is shown both good examples (positive)
and counter-examples (negative) to refine its understanding.
 Incremental Learning: With each new example, the program either generalizes or
specializes the concept to better fit all the observed examples. The process is
gradual, and the program's knowledge evolves over time.
 Relational Learning: The program learns not just about individual objects, but about
relationships between objects. This is crucial for understanding complex structures
like an arch, which involves multiple blocks in specific spatial relationships.

Benefits of Winston's Learning Program:

1. Learning Complex Structures: The program is able to learn concepts that are based
on the relationships between elements, such as spatial arrangements, which makes
it useful for tasks like visual recognition and understanding.
2. Generalization and Specialization: The ability to generalize from examples and
specialize based on counterexamples makes the learning more flexible and adaptive.
3. Symbolic Learning: Since the program uses symbolic representations, it allows for
clearer and more interpretable models of learned concepts compared to purely
statistical methods.

Challenges:

 Limited by Example Quality: The effectiveness of the program heavily depends on


the quality and diversity of the examples it is shown. If the examples are too narrow,
the program might overgeneralize or overspecialize.
 Symbolic Systems: Symbolic learning systems like this one can struggle with noisy or
ambiguous data, where patterns aren't as clear or deterministic.

Applications:

 Winston's learning approach inspired later work in AI, especially in symbolic


reasoning and concept learning. It’s useful in domains like:
o Computer Vision: Recognizing objects based on their relationships and
structures.
o Robotics: Understanding how to manipulate objects by learning their
structural and spatial relations.

Decision Trees are a popular machine learning technique used for classification and
regression tasks. They model decisions and their possible consequences in a tree-like
structure, where each internal node represents a feature (or attribute), each branch
represents a decision rule, and each leaf node represents an outcome or class label.

Regression is a statistical and machine learning technique used to model and analyze the relationships between a dependent variable
(often referred to as the output or target variable) and one or more independent variables (also known as features or predictors). The
primary goal of regression is to predict the value of the dependent variable based on the values of the independent variables.

Consider a simple example where we want to predict the price of a house based on its size (in square feet).

 Dependent Variable: Price of the house (in dollars).


 Independent Variable: Size of the house (in square feet).

Classification in the context of learning from examples refers to the process where an AI system or algorithm learns to assign labels or
categories to new data based on examples it has seen during training. This is a type of supervised learning, where the system is given
input-output pairs (examples) and learns to map new inputs to their correct outputs.

EX: Email Spam Classification.


Two of the most widely known algorithms for creating decision trees are ID3 (Iterative
Dichotomiser 3) and C4.5. These two algorithms were introduced by Quinlan for inducing
classification models.

ID3 (Iterative Dichotomiser 3)

1. Overview:
o Developed by Ross Quinlan in 1986, ID3 is used for generating a decision tree
based on a set of training data.
o The goal is to create a tree that accurately classifies the training examples
into their respective categories.
2. Key Concepts:
o Entropy: A measure of impurity or disorder in the dataset. It is used to
evaluate how well a particular attribute separates the classes.
o Information Gain: The reduction in entropy after splitting the dataset based
on a certain attribute. The attribute with the highest information gain is
chosen for the split.
3. Building the Tree:
o Start with the entire dataset and calculate the entropy.
o For each attribute, calculate the information gain by splitting the dataset
based on that attribute.
o Select the attribute with the highest information gain as the decision node.
o Recursively repeat the process for each subset of the data until:
 All examples are classified correctly (pure subsets).
 There are no more attributes to split on.
 A stopping criterion is met (e.g., maximum tree depth).
4. Limitations:
o ID3 can lead to overfitting, especially with noisy data or when there are many
attributes.
o It can only handle categorical data, requiring transformation for continuous
features.

C4.5

1. Overview:
o C4.5 is an extension of ID3, developed by Ross Quinlan in 1993. It improves
upon ID3 by handling a broader range of data types and addressing some
limitations of ID3.
2. Key Concepts:
o Gain Ratio: Unlike ID3, which uses information gain, C4.5 uses gain ratio to
overcome the bias of information gain towards attributes with many values.
Gain ratio adjusts information gain by considering the intrinsic information of
the attribute (the amount of information generated by splitting the dataset).
o Handling Continuous Data: C4.5 can handle both categorical and continuous
attributes. For continuous attributes, it determines the best split point by
examining the values of the attribute and selecting a threshold that
maximizes information gain.
3. Building the Tree:
o Similar to ID3, but with enhancements:
 Calculate the gain ratio for each attribute and select the one with the
highest gain ratio as the decision node.
 Handle continuous attributes by determining the best threshold for
splitting.
 Prune the tree after it is fully grown to reduce overfitting. This
involves removing branches that have little importance.
4. Advantages:
o Handles both categorical and continuous data.
o Pruning reduces the risk of overfitting.
o More robust and effective with noisy datasets.

Comparison of ID3 and C4.5

Feature ID3 C4.5

Developed By Ross Quinlan (1986) Ross Quinlan (1993)

Data Type Handling Categorical only Categorical and continuous

Splitting Criterion Information Gain Gain Ratio

Overfitting Management No pruning Prunes the tree

Handling Missing Values Poorly Can handle missing values

Output Decision tree Decision tree with rules

Both ID3 and C4.5 are foundational algorithms for decision tree learning, each with its
strengths and weaknesses. ID3 introduced the basic concepts of decision trees, while C4.5
improved upon them significantly, making it more versatile and applicable to real-world
problems. In practice, decision trees remain a popular choice due to their interpretability
and ease of use in classification tasks.

To illustrate how decision trees (specifically using the ID3 or C4.5 algorithms) work with a
real-world example, we will consider the scenario of determining whether to play golf
based on various weather conditions.

ID3
Example: Weather Conditions for Playing Golf

In this example, we have a dataset of weather conditions, and we want to determine if the
decision to play golf (a categorical outcome) can be made based on several attributes. The
attributes include:

1. Outlook (Categorical): Can be sunny, overcast, or rainy.


2. Temperature (Continuous): Measured in degrees.
3. Humidity (Continuous): Measured as a percentage.
4. Windy (Categorical): True or False.

Training Data Table

Here's a sample training dataset representing various weather conditions and the
corresponding decision to play golf:

Day Outlook Temperature Humidity Windy Play Golf

1 Sunny 85 85 False No

2 Sunny 80 90 True No

3 Overcast 83 78 False Yes

4 Rain 70 96 False Yes

5 Rain 68 80 False Yes

6 Rain 65 70 True No

6 Overcast 64 65 True Yes

7 Sunny 72 95 False No

8 Sunny 69 70 False Yes

9 Rain 75 80 False Yes

10 Sunny 75 70 True Yes

11 Overcast 72 90 True Yes

12 Overcast 81 75 False Yes

13 Rain 71 80 True No

Building the Decision Tree


1. Calculate Entropy and Information Gain:
o To decide which attribute to split on first, we need to calculate the entropy
for the entire dataset and then calculate the information gain for each
attribute.

2. Attribute Evaluation:
o For each attribute (Outlook, Temperature, Humidity, Windy), calculate the
information gain by determining how much the entropy decreases when the
dataset is split on that attribute.

You might also like