You are on page 1of 66

Advanced Techniques in AI COMPUTATIONAL INTELLIGENCE &

Machine Learning

Course Instructor: Muhammad Nazir


nazir@szabist-isb.edu.pk

INTRODUCTION

Tentative Grading

Quizzes Assignments Project Midterm Exams Final Exam

10 10 10 30 40 -----------100

INTRODUCTION
Course Outline: Machine Learning Introduction Version Spaces Decision Trees Learning Set of Rules Bayesian Learning Unsupervised Learning Instance based Learning Reinforcement Learning

INTRODUCTION

Course outline Computational Intelligence Neural networks Artificial immune system Genetic algorithms Genetic programming Particle swarm optimization Ant colony optimization Differential and cultural evolution Co-evolution Evolution strategies Fuzzy computing

INTRODUCTION

What is Machine Learning? The field of machine learning is concerned with the question of how to construct computer programs that automatically improve with experience (T. Mitchell) Principles, methods, and algorithms for learning and prediction on the basis of past experience (MIT)

In the broadest sense, The field of machine learning studies the design of computer programs (agents) capable of learning from past experience or adapting to changes in the environment
5

INTRODUCTION

Learning process: Learner (a computer program) processes data D representing past experiences and tries to either develop an appropriate response to future data, or describe in some meaningful way the data seen Example:

Learner sees a set of patient cases (patient records) with corresponding diagnoses. It can either try: To predict the presence of a disease for future patients Describe the dependencies between diseases
6

INTRODUCTION

What is Machine Learning? Definition: A computer program is said to learn from experience E with respect to some tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E. Example (Handwriting Recognition Problem): Task T: recognizing handwritten words within images Performance Measure P: percent of words correctly classified Training Experience E: data of handwritten words with given classifications
7

INTRODUCTION

What is Machine Learning? Example :

Application Areas
Predicting customer behaviour

Identifying fraud
Discovering effective medical therapies for diverse illnesses Credit risk evaluation Face detection Speech recognition Character recognition Load forecasting and many more

INTRODUCTION

What is Machine Learning? A simple decision model

10

INTRODUCTION

What is Machine Learning? An overly complex decision model This may lead to worse classification than a simple model

11

INTRODUCTION

What is Machine Learning?

A classification problem: the grades for students taking this course


Key Steps: 1. Data (what past experience can we rely on?) 2. Assumptions (what can we assume about the students or the course?) 3. Representation (how do we summarize a student?) 4. Estimation (how do we construct a map from students to grades?) 5. Model Selection 6. Evaluation (how well are we predicting?)
12

INTRODUCTION

What is Machine Learning?

1. Data: The data we have available may be:


- names and grades of students in past years ML courses - academic record of past and current students Student Ali Ahmed Usman Umar ML A B ? ? Course X B A C A Course Y A A A A

Training data Current data


13

INTRODUCTION

What is Machine Learning? 2. Assumptions: There are many assumptions we can make to facilitate predictions 1. The course has remained same roughly over the years 2. Each student performs independently from others

14

INTRODUCTION

What is Machine Learning?

3. Representation:
Academic records are rather diverse so we might limit the summaries to a select few courses For example, we can summarize the ith student (say Ahmed) with a vector Xi = [A C B] where the grades may correspond to numerical values

15

INTRODUCTION

What is Machine Learning?

3. Representation:
The available data in this representation is:

Training data Student ML grade X1t B X2t A

Data for prediction Student ML grade X1p ? X2p ?

16

INTRODUCTION

What is Machine Learning?

4. Estimation
Given the training data

Student X1t X2t

ML grade B A

we need to find a mapping from input vectors x to labels y encoding the grades for the ML course.
17

INTRODUCTION

What is Machine Learning?

Possible solution (nearest neighbor classifier):


1. For any student x find the closest student xi in the training set 2. Predict yi, the grade of the closest student

18

INTRODUCTION

What is Machine Learning?

5. Evaluation
How can we tell how good our predictions are? - we can try to assess the accuracy based on the data we already have

Possible solution: - divide the data into training & test sets - evaluate the classifier on the test set

19

INTRODUCTION

What is Machine Learning?

We can refine
- The estimation algorithm (e.g., using a classifier other than the nearest neighbor classifier) - The representation (e.g., base the summaries on a different set of courses) - The assumptions (e.g., perhaps students work in groups) etc. We have to rely on the method of evaluating the accuracy of our predictions to select among the possible refinements
20

INTRODUCTION

Types of Machine Learning

21

INTRODUCTION

Types of Machine Learning Data can be - Symbolic or Categorical (e.g. High Temperature)

- Numerical (e.g. 45 0C)

22

INTRODUCTION

Types of Machine Learning From the available data we can - Model the system which has generated the data - Find interesting patterns in the data We will be primarily concerned with rule based modelling of the system from which the data was generated

The search for interesting patterns is considered to be the domain of Data Mining

23

INTRODUCTION

Types of Machine Learning Supervised learning, where we get a set of training inputs and outputs. The correct output for the training samples is available

24

INTRODUCTION

Supervised Learning Plot of a training data set of N = 10 points, shown as blue circles, each comprising an observation of the input variable x along with the corresponding target variable t The green curve shows the function sin(2x) used to generate the data. Our goal is to predict the value of t for some new value of x, without knowledge of the green curve.

25

INTRODUCTION

Types of Machine Learning Unsupervised learning, where we are interested in capturing inherent organization in the data. No specific output values are supplied with the learning patterns
Iteration 6
3 2.5

1.5

y
1 0.5 0 -2

-1.5

-1

-0.5

0.5

1.5

26

INTRODUCTION

Types of Machine Learning Reinforcement learning, where there are no exact outputs supplied, but there is a reward (reinforcement) for desirable behaviour

27

INTRODUCTION

Why Use Machine Learning

28

INTRODUCTION

Why Use Machine Learning?

First, there are problems for which there exist no human experts.
Example: in modern automated manufacturing facilities, there is a need to predict machine failures before they occur by analyzing sensor readings. Because the machines are new, there are no human experts who can be interviewed by a programmer to provide the knowledge necessary to build a computer system. A machine learning system can study recorded data and subsequent machine failures and learn prediction rules.
29

INTRODUCTION

Why Use Machine Learning?

Second, there are problems where human experts exist, but where they are unable to explain their expertise.
This is the case in many perceptual tasks, such as speech recognition, hand-writing recognition, and natural language understanding. Virtually all humans exhibit expert-level abilities on these tasks, but none of them can describe the detailed steps that they follow as they perform them. Fortunately, humans can provide machines with examples of the inputs and correct outputs for these tasks, so machine learning algorithms can learn to map the inputs to the outputs.
30

INTRODUCTION

Why Use Machine Learning?

31

INTRODUCTION

Why Use Machine Learning? Third, there are problems where phenomena are changing rapidly. Example: people would like to predict the future behavior of the stock market, of consumer purchases, or of exchange rates. The rules and parameters governing these behaviors change frequently, so that the computer program for prediction would need to be rewritten frequently.

32

INTRODUCTION
Useful Reading 1st Chapter of Tom Mitchells book

33

INTRODUCTION
What is Computational Intelligence? Computational intelligence is a branch of computer science studying problems for which there are no effective computational algorithms Consists of four paradigms - Neural Networks - Evolutionary Computations - Swarm Intelligence - Fuzzy Systems The field is an off-shoot of the AI family In the 1990s, the term Soft Computing gained popularity This later on became Computational Intelligence

INTRODUCTION

IEEE Computational Intelligence Society: Publishes three highly regarded IEEE Transactions - IEEE Transactions on Neural Networks - IEEE Transactions on Fuzzy Systems - IEEE Transactions on Evolutionary Computations

Organizes several prestigious conferences Visit the Societys website & note conference names

VERSION SPACE

Concept Learning by Induction

Learning has been classified into several types: deductive, inductive, analytical, etc.
Much of human learning involves acquiring general concepts from specific training examples (this is called inductive learning)

36

VERSION SPACE

Concept Learning by Induction

Example: Concept of ball * red, round, small * green, round, small * red, round, medium
Complicated concepts: situations in which I should study more to pass the exam

37

VERSION SPACE

Concept Learning by Induction

Each concept can be thought of as a Boolean-valued function whose value is true for some inputs and false for all the rest (e.g. a function defined over all the animals, whose value is true for birds and false for all the other animals)
This lecture is about the problem of automatically inferring the general definition of some concept, given examples labeled as members or nonmembers of the concept. This task is called concept learning, or approximating (inferring) a Boolean valued function from examples

38

VERSION SPACE

Concept Learning by Induction Target Concept to be learnt: Days on which Aldo enjoys his favorite water sport Training Examples present are:

39

VERSION SPACE

Concept Learning by Induction

The training examples are described by the values of seven Attributes


The task is to learn to predict the value of the attribute EnjoySport for an arbitrary day, based on the values of its other attributes

40

VERSION SPACE

Concept Learning by Induction: Hypothesis Representation The possible concepts are called Hypotheses and we need an appropriate representation for the hypotheses Let the hypothesis be a conjunction of constraints on the attribute-values

41

VERSION SPACE

Concept Learning by Induction: Hypothesis Representation If sky = sunny temp = warm humidity = ? wind = strong water = ? forecast = same then Enjoy Sport = Yes else Enjoy sport = No Alternatively, this can be written as: {sunny, warm, ?, strong, ?, same}
42

VERSION SPACE

Concept Learning by Induction: Hypothesis Representation For each attribute, the hypothesis will have either ? Any value is acceptable Value Any single value is acceptable No value is acceptable

43

VERSION SPACE

Concept Learning by Induction: Hypothesis Representation If some instance (example/observation) satisfies all the constraints of a hypothesis, then it is classified as positive (belonging to the concept) The most general hypothesis is {?, ?, ?, ?, ?, ?} It would classify every example as a positive example The most specific hypothesis is {, , , , , } It would classify every example as negative
44

VERSION SPACE

Concept Learning by Induction: Hypothesis Representation Alternate hypothesis representation could have been Disjunction of several conjunction of constraints on the attribute-values Example: {sunny, warm, normal, strong, warm, same} {sunny, warm, high, strong, warm, same} {sunny, warm, high, strong, cool, change}

45

VERSION SPACE

Concept Learning by Induction: Hypothesis Representation Another alternate hypothesis representation could have been Conjunction of constraints on the attribute-values where each constraint may be a disjunction of values Example: {sunny, warm, normal high, strong, warm cool, same change}

46

VERSION SPACE

Concept Learning by Induction: Hypothesis Representation Yet another alternate hypothesis representation could have incorporated negations

Example: {sunny, warm, (normal high), ?, ?, ?}

47

VERSION SPACE

Concept Learning by Induction: Hypothesis Representation By selecting a hypothesis representation, the space of all hypotheses (that the program can ever represent and therefore can ever learn) is implicitly defined In our example, the instance space X can contain 3.2.2.2.2.2 = 96 distinct instances

There are 5.4.4.4.4.4 = 5120 syntactically distinct hypotheses. Since every hypothesis containing even one classifies every instance as negative, hence semantically distinct hypotheses are: 4.3.3.3.3.3 + 1 = 973
48

VERSION SPACE

Concept Learning by Induction: Hypothesis Representation Most practical learning tasks involve much larger, sometimes infinite, hypothesis spaces

49

VERSION SPACE

Concept Learning by Induction: Search in Hypotheses Space Concept learning can be viewed as the task of searching through a large space of hypotheses implicitly defined by the hypothesis representation The goal of this search is to find the hypothesis that best fits the training examples

50

VERSION SPACE

Concept Learning by Induction: Basic Assumption Once a hypothesis that best fits the training examples is found, we can use it to predict the class label of new examples The basic assumption while using this hypothesis is: Any hypothesis found to approximate the target function well over a sufficiently large set of training examples will also approximate the target function well over other unobserved examples
51

VERSION SPACE

Concept Learning by Induction: General to Specific Ordering If we view learning as a search problem, then it is natural that our study of learning algorithms will examine different strategies for searching the hypothesis space Many algorithms for concept learning organize the search through the hypothesis space by relying on a general to specific ordering of hypotheses

52

VERSION SPACE

Concept Learning by Induction: General to Specific Ordering Example: Consider h1 = {sunny, ?, ?, strong, ?, ?} h2 = {sunny, ?, ?, ?, ?, ?} any instance classified positive by h1 will also be classified positive by h2 (because it imposes fewer constraints on the instance) Hence h2 is more general than h1 and h1 is more specific than h2

53

VERSION SPACE

Concept Learning by Induction: General to Specific Ordering Consider the three hypotheses h1, h2 and h3

54

VERSION SPACE

Concept Learning by Induction: General to Specific Ordering

Neither h1 nor h3 is more general than the other


h2 is more general than both h1 and h3

Note that the more-general-than relationship is independent of the target concept. It depends only on which instances satisfy the two hypotheses and not on the classification of those instances according to the target concept

55

VERSION SPACE

Find-S Algorithm How to find a hypothesis consistent with the observed training examples? - A hypothesis is consistent with the training examples if it correctly classifies these examples One way is to begin with the most specific possible hypothesis, then generalize it each time it fails to cover a positive training example (i.e. classifies it as negative) The algorithm based on this method is called Find-S
56

VERSION SPACE

Find-S Algorithm We say that a hypothesis covers a positive training example if it correctly classifies the example as positive

A positive training example is an example of the concept to be learnt


Similarly a negative training example is not an example of the concept

57

VERSION SPACE

Find-S Algorithm

58

VERSION SPACE

Find-S Algorithm

59

VERSION SPACE

Find-S Algorithm The nodes shown in the diagram are the possible hypotheses allowed by our hypothesis representation scheme

Note that our search is guided by the positive examples and we consider only those hypotheses which are consistent with the positive training examples The search moves from hypothesis to hypothesis, searching from the most specific to progressively more general hypotheses
60

VERSION SPACE

Find-S Algorithm At each step, the hypothesis is generalized only as far as necessary to cover the new positive example

Therefore, at each stage the hypothesis is the most specific hypothesis consistent with the training examples observed up to this point Hence, it is called Find-S

61

VERSION SPACE

Find-S Algorithm Note that the algorithm simply ignores every negative example

However, since at each step our current hypothesis is maximally specific it will never cover (falsely classify) any negative example. In other words, it will be always consistent with each negative training example
However the data must be noise free and our hypothesis representation should be such that the true concept can be described by it
62

VERSION SPACE

Find-S Algorithm Problems with Find-S: 1. 2. 3. 4. Has the learner converged to the true target concept? Why prefer the most specific hypothesis? Are the training examples consistent with each other? What if there are several maximally specific consistent hypotheses?

63

VERSION SPACE

Definition: Version Space Version Space is the set of hypotheses consistent with the training examples of a problem

Find-S algorithm finds one hypothesis present in the Version Space, however there may be others

64

VERSION SPACE

Reference Sections 2.1 2.4 of T. Mitchell

65

INTRODUCTION

Course Book Machine Learning by Tomm Mitchell, MCRAW HILL,1997. Computational Intelligence: An Introduction by Andries P. Engelbrecht, John Wiley & Sons, 2002 Reference Books Fundamentals of Neural Network by Laurene Fausett

You might also like