SlideShare a Scribd company logo
1 of 5
Download to read offline
Ahsanullah University of Science and Technology
Department of Computer Science and Engineering
Experiment No 1
Designing A Minimum Distance to Class
Mean Classifier
Pattern Recognition Lab
CSE – 4214
Submitted By
Name: Md. Toufique Hasan
ID: 12.02.04.069
Year: 4th
Semester: 2nd
Section: B (B1)
Date of Submission: 18-06-2016
Designing A Minimum Distance to Class Mean Classifier
Md. Toufique Hasan
Department of Computer Science and Engineering
Ahsanullah University of Science and Technology
Dhaka, Bangladesh
toufique.hasan@hotmail.com
Objective
The main objective of this assignment is to design a
minimum distance to class mean classifier
1. Introduction
Class Mean Classifier is used to classify unclassified
sample vectors where the vectors are classified in more
than one class. For example, in our dataset we have some
sample vectors. Some given sample vectors are already
classified into different classes and some are not
classified. We can classify the unclassified sample
vectors by the help of Minimum Distance to Class Mean
Classifier.
2. Task
Given the following two-class set of prototypes
w1 = {(2,2), (3,1), (3,3), (-1,-3), (4,2), (-2,-2)}
w2 = {(0,0), (-2,2), (-1,-1), (-4,2), (-4,3), (2,6)}
a. Plot all sample points from both classes, but
samples from the same class should have the
same color and marker.
b. Using a minimum distance classifier with
respect to ‘class mean’, classify the following
points by plotting them with the designated
class-color but different marker.
X1 = (-1, -1)
X2 = (3, 2)
X3 = (-2, 1)
X4 = (8, 2)
Linear Discriminant Function:
c. Draw the decision boundary between the two-
classes.
3. Implementation
a. First Step (Plot all sample points):
Two classes are given. At first we have to plot
all the sample points of both classes. Samples from the
same class are plotted using the same color and marker.
So that different classes can be distinguished easily. Here
red stars ‘*’ represent class w1 and green stars ‘*’
represent class w2.
Figure 1: Plot all the sample points
b. Second Step (Classify the following points):
The mean points of the two classes are
calculated & plotted with same class color with the ‘O’
marker (‘O’ for class w1 & ‘O’ for class w2).
Now for each of the point (X1, X2, X3, X4) we can
calculate the distance from the calculate mean of each
class using Linear Discriminant Function.
Here red cross ‘x’ represent class w1 and green cross ‘x’
represent class w2. We use the same class color but
different marker while plotting those points.
Figure 2: Minimum distance classifier with respect to
class mean & classify some samples
c. Third Step (Drawing the decision boundary)
In the last step, we will draw the decision boundary.
For finding out the decision boundary we will consider
all possible points within the range. We will consider
those points as over the boundary line whose distance
from both the classes are same. Here ‘-.’ line creates with
blue color represents the linear decision boundary
between the two classes.
Figure 3: Drawing the decision boundary
4. MATLAB Code
%Import Sample Points From Text
Files
w1 = zeros(2,10);
myfile = fopen('w1.txt','r');
w1 = fscanf(myfile,'%f
%f',size(w1));
w1 = w1';
w2 = zeros(2,10);
myfile = fopen('w2.txt','r');
w2 = fscanf(myfile,'%f
%f',size(w2));
w2 = w2';
%Plotting The Sample Points
title('Designing a Minimum
Distance to Class Mean
Classifier','FontName','Comic Sans
MS');
hold on;
p1 =
plot(w1(:,1),w1(:,2),'h','MarkerEd
geColor','r','LineWidth',1.5);
hold on;
p2 =
plot(w2(:,1),w2(:,2),'h','MarkerEd
geColor','g','LineWidth',1.5);
xlabel('X1');
ylabel('X2');
%Calculating Class Mean
y1 = [mean(w1(:,1)),mean(w1(:,2))]
y2 = [mean(w2(:,1)),mean(w2(:,2))]
%Plotting Class Mean
hold on
p3 =
plot(y1(1),y1(2),'o','MarkerEdgeCo
lor','r','LineWidth',1.5);
hold on
p4 =
plot(y2(1),y2(2),'o','MarkerEdgeCo
lor','g','LineWidth',1.5);
%Points for testing
sample = zeros(2,10);
myfile = fopen('sample.txt','r');
sample = fscanf(myfile,'%f
%f',size(sample));
sample = sample';
5. Result Analysis
We have taken two datasets for result analysis. Each
classes in datasets contains 10 sample values. Some of
them are classified and some are not.
For dataset 1, 4 samples out of 10 from class 1 are
misclassified with respect to decision boundary. And all
the training samples are classified correctly. So, the
accuracy is 80%.
Figure 4: Result analysis for dataset 1
Now for dataset 2, 2 samples out of 10 from class 1
and 3 samples out of 10 from class 2 are miss classified
with respect to decision boundary. And all the training
samples are classified correctly. So, the accuracy is 75%.
Figure 5: Result analysis for dataset 2
%Calculating Linear Discriminant
Function
for i = 1:length(sample)
g1 = sample(i,:)*y1'-
.5*(y1*y1');
g2 = sample(i,:)*y2'-
.5*(y2*y2');
if g1 > g2
plot(sample(i,1),sample(i,2),'x','
MarkerEdgeColor','r','LineWidth',1
.5);
else
plot(sample(i,1),sample(i,2),'x','
MarkerEdgeColor','g','LineWidth',1
.5);
end
end
%Decision Boundary Between Two-
classes
coefficient = y1-y2;
constant = -0.5*det((y1' * y1)-
(y2' * y2));
b = [-4:2:8];
for i = 1:length(b)
y(:,i) = -((coefficient(1,1)*
b(:,i)+constant)/coefficient(1,2))
;
end
d_boundary = [b',y'];
plot(d_boundary(:,1),d_boundary(:,
2),'-.b');
hold off;
6. Conclusion
In this assignment some sample are classified and
some are misclassified. I want to apply this assignment in
an easy away. It has simple calculation. So that the speed
of this result is too efficient. The main weakness of this
algorithm is its misclassification rate is higher because
the boundary between two classes is linear.

More Related Content

What's hot

Image segmentation in Digital Image Processing
Image segmentation in Digital Image ProcessingImage segmentation in Digital Image Processing
Image segmentation in Digital Image ProcessingDHIVYADEVAKI
 
Designing a Minimum Distance classifier to Class Mean Classifier
Designing a Minimum Distance classifier to Class Mean ClassifierDesigning a Minimum Distance classifier to Class Mean Classifier
Designing a Minimum Distance classifier to Class Mean ClassifierDipesh Shome
 
Image Restoration (Order Statistics Filters)
Image Restoration (Order Statistics Filters)Image Restoration (Order Statistics Filters)
Image Restoration (Order Statistics Filters)Kalyan Acharjya
 
Chapter 2. Digital Image Fundamentals.pdf
Chapter 2. Digital Image Fundamentals.pdfChapter 2. Digital Image Fundamentals.pdf
Chapter 2. Digital Image Fundamentals.pdfDngThanh44
 
Digital Image Processing - Image Restoration
Digital Image Processing - Image RestorationDigital Image Processing - Image Restoration
Digital Image Processing - Image RestorationMathankumar S
 
Image Enhancement - Point Processing
Image Enhancement - Point ProcessingImage Enhancement - Point Processing
Image Enhancement - Point ProcessingGayathri31093
 
10 color image processing
10 color image processing10 color image processing
10 color image processingbabak danyal
 
Digital Image restoration
Digital Image restorationDigital Image restoration
Digital Image restorationMd Shabir Alam
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial DomainA B Shinde
 
Digital Image Processing: Image Segmentation
Digital Image Processing: Image SegmentationDigital Image Processing: Image Segmentation
Digital Image Processing: Image SegmentationMostafa G. M. Mostafa
 
Image pre processing - local processing
Image pre processing - local processingImage pre processing - local processing
Image pre processing - local processingAshish Kumar
 
digital image processing, image processing
digital image processing, image processingdigital image processing, image processing
digital image processing, image processingKalyan Acharjya
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filtersA B Shinde
 

What's hot (20)

Image segmentation in Digital Image Processing
Image segmentation in Digital Image ProcessingImage segmentation in Digital Image Processing
Image segmentation in Digital Image Processing
 
Designing a Minimum Distance classifier to Class Mean Classifier
Designing a Minimum Distance classifier to Class Mean ClassifierDesigning a Minimum Distance classifier to Class Mean Classifier
Designing a Minimum Distance classifier to Class Mean Classifier
 
raycasting. ppt
raycasting. pptraycasting. ppt
raycasting. ppt
 
Image Restoration (Order Statistics Filters)
Image Restoration (Order Statistics Filters)Image Restoration (Order Statistics Filters)
Image Restoration (Order Statistics Filters)
 
Chapter 2. Digital Image Fundamentals.pdf
Chapter 2. Digital Image Fundamentals.pdfChapter 2. Digital Image Fundamentals.pdf
Chapter 2. Digital Image Fundamentals.pdf
 
Digital Image Processing - Image Restoration
Digital Image Processing - Image RestorationDigital Image Processing - Image Restoration
Digital Image Processing - Image Restoration
 
Dip Image Segmentation
Dip Image SegmentationDip Image Segmentation
Dip Image Segmentation
 
Image Enhancement - Point Processing
Image Enhancement - Point ProcessingImage Enhancement - Point Processing
Image Enhancement - Point Processing
 
Chap6 image restoration
Chap6 image restorationChap6 image restoration
Chap6 image restoration
 
10 color image processing
10 color image processing10 color image processing
10 color image processing
 
Digital Image restoration
Digital Image restorationDigital Image restoration
Digital Image restoration
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Digital Image Processing: Image Segmentation
Digital Image Processing: Image SegmentationDigital Image Processing: Image Segmentation
Digital Image Processing: Image Segmentation
 
Image pre processing - local processing
Image pre processing - local processingImage pre processing - local processing
Image pre processing - local processing
 
image enhancement
 image enhancement image enhancement
image enhancement
 
digital image processing, image processing
digital image processing, image processingdigital image processing, image processing
digital image processing, image processing
 
Segmentation
SegmentationSegmentation
Segmentation
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filters
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 

Similar to Designing A Minimum Distance to Class Mean Classifier

Pattern Recognition: Class mean classifier
Pattern Recognition: Class mean classifierPattern Recognition: Class mean classifier
Pattern Recognition: Class mean classifierMd Mamunur Rashid
 
Clustering-dendogram.pptx
Clustering-dendogram.pptxClustering-dendogram.pptx
Clustering-dendogram.pptxANKIT915111
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manualAnkit Kumar
 
Principal Components Analysis, Calculation and Visualization
Principal Components Analysis, Calculation and VisualizationPrincipal Components Analysis, Calculation and Visualization
Principal Components Analysis, Calculation and VisualizationMarjan Sterjev
 
Distance and midpoint formula
Distance and midpoint formulaDistance and midpoint formula
Distance and midpoint formulaNoel Guzman
 
Unit-1 Introduction and Mathematical Preliminaries.pptx
Unit-1 Introduction and Mathematical Preliminaries.pptxUnit-1 Introduction and Mathematical Preliminaries.pptx
Unit-1 Introduction and Mathematical Preliminaries.pptxavinashBajpayee1
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfRajJain516913
 
Fessant aknin oukhellou_midenet_2001:comparison_of_supervised_self_organizing...
Fessant aknin oukhellou_midenet_2001:comparison_of_supervised_self_organizing...Fessant aknin oukhellou_midenet_2001:comparison_of_supervised_self_organizing...
Fessant aknin oukhellou_midenet_2001:comparison_of_supervised_self_organizing...ArchiLab 7
 
Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...
Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...
Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...sipij
 
Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional arrayRajendran
 
Learning multifractal structure in large networks (Purdue ML Seminar)
Learning multifractal structure in large networks (Purdue ML Seminar)Learning multifractal structure in large networks (Purdue ML Seminar)
Learning multifractal structure in large networks (Purdue ML Seminar)Austin Benson
 
Dimension Reduction Introduction & PCA.pptx
Dimension Reduction Introduction & PCA.pptxDimension Reduction Introduction & PCA.pptx
Dimension Reduction Introduction & PCA.pptxRohanBorgalli
 
Dynamic time wrapping (dtw), vector quantization(vq), linear predictive codin...
Dynamic time wrapping (dtw), vector quantization(vq), linear predictive codin...Dynamic time wrapping (dtw), vector quantization(vq), linear predictive codin...
Dynamic time wrapping (dtw), vector quantization(vq), linear predictive codin...Tanjarul Islam Mishu
 
Graphical presentation of data
Graphical presentation of dataGraphical presentation of data
Graphical presentation of dataprince irfan
 

Similar to Designing A Minimum Distance to Class Mean Classifier (20)

Pattern Recognition: Class mean classifier
Pattern Recognition: Class mean classifierPattern Recognition: Class mean classifier
Pattern Recognition: Class mean classifier
 
Lda
LdaLda
Lda
 
Km2417821785
Km2417821785Km2417821785
Km2417821785
 
[PPT]
[PPT][PPT]
[PPT]
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Clustering-dendogram.pptx
Clustering-dendogram.pptxClustering-dendogram.pptx
Clustering-dendogram.pptx
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Principal Components Analysis, Calculation and Visualization
Principal Components Analysis, Calculation and VisualizationPrincipal Components Analysis, Calculation and Visualization
Principal Components Analysis, Calculation and Visualization
 
Lect4
Lect4Lect4
Lect4
 
Distance and midpoint formula
Distance and midpoint formulaDistance and midpoint formula
Distance and midpoint formula
 
Unit-1 Introduction and Mathematical Preliminaries.pptx
Unit-1 Introduction and Mathematical Preliminaries.pptxUnit-1 Introduction and Mathematical Preliminaries.pptx
Unit-1 Introduction and Mathematical Preliminaries.pptx
 
test & measuement
test & measuementtest & measuement
test & measuement
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
 
Fessant aknin oukhellou_midenet_2001:comparison_of_supervised_self_organizing...
Fessant aknin oukhellou_midenet_2001:comparison_of_supervised_self_organizing...Fessant aknin oukhellou_midenet_2001:comparison_of_supervised_self_organizing...
Fessant aknin oukhellou_midenet_2001:comparison_of_supervised_self_organizing...
 
Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...
Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...
Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...
 
Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional array
 
Learning multifractal structure in large networks (Purdue ML Seminar)
Learning multifractal structure in large networks (Purdue ML Seminar)Learning multifractal structure in large networks (Purdue ML Seminar)
Learning multifractal structure in large networks (Purdue ML Seminar)
 
Dimension Reduction Introduction & PCA.pptx
Dimension Reduction Introduction & PCA.pptxDimension Reduction Introduction & PCA.pptx
Dimension Reduction Introduction & PCA.pptx
 
Dynamic time wrapping (dtw), vector quantization(vq), linear predictive codin...
Dynamic time wrapping (dtw), vector quantization(vq), linear predictive codin...Dynamic time wrapping (dtw), vector quantization(vq), linear predictive codin...
Dynamic time wrapping (dtw), vector quantization(vq), linear predictive codin...
 
Graphical presentation of data
Graphical presentation of dataGraphical presentation of data
Graphical presentation of data
 

Recently uploaded

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 

Recently uploaded (20)

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 

Designing A Minimum Distance to Class Mean Classifier

  • 1. Ahsanullah University of Science and Technology Department of Computer Science and Engineering Experiment No 1 Designing A Minimum Distance to Class Mean Classifier Pattern Recognition Lab CSE – 4214 Submitted By Name: Md. Toufique Hasan ID: 12.02.04.069 Year: 4th Semester: 2nd Section: B (B1) Date of Submission: 18-06-2016
  • 2. Designing A Minimum Distance to Class Mean Classifier Md. Toufique Hasan Department of Computer Science and Engineering Ahsanullah University of Science and Technology Dhaka, Bangladesh toufique.hasan@hotmail.com Objective The main objective of this assignment is to design a minimum distance to class mean classifier 1. Introduction Class Mean Classifier is used to classify unclassified sample vectors where the vectors are classified in more than one class. For example, in our dataset we have some sample vectors. Some given sample vectors are already classified into different classes and some are not classified. We can classify the unclassified sample vectors by the help of Minimum Distance to Class Mean Classifier. 2. Task Given the following two-class set of prototypes w1 = {(2,2), (3,1), (3,3), (-1,-3), (4,2), (-2,-2)} w2 = {(0,0), (-2,2), (-1,-1), (-4,2), (-4,3), (2,6)} a. Plot all sample points from both classes, but samples from the same class should have the same color and marker. b. Using a minimum distance classifier with respect to ‘class mean’, classify the following points by plotting them with the designated class-color but different marker. X1 = (-1, -1) X2 = (3, 2) X3 = (-2, 1) X4 = (8, 2) Linear Discriminant Function: c. Draw the decision boundary between the two- classes. 3. Implementation a. First Step (Plot all sample points): Two classes are given. At first we have to plot all the sample points of both classes. Samples from the same class are plotted using the same color and marker. So that different classes can be distinguished easily. Here red stars ‘*’ represent class w1 and green stars ‘*’ represent class w2. Figure 1: Plot all the sample points b. Second Step (Classify the following points): The mean points of the two classes are calculated & plotted with same class color with the ‘O’ marker (‘O’ for class w1 & ‘O’ for class w2). Now for each of the point (X1, X2, X3, X4) we can calculate the distance from the calculate mean of each class using Linear Discriminant Function. Here red cross ‘x’ represent class w1 and green cross ‘x’ represent class w2. We use the same class color but different marker while plotting those points.
  • 3. Figure 2: Minimum distance classifier with respect to class mean & classify some samples c. Third Step (Drawing the decision boundary) In the last step, we will draw the decision boundary. For finding out the decision boundary we will consider all possible points within the range. We will consider those points as over the boundary line whose distance from both the classes are same. Here ‘-.’ line creates with blue color represents the linear decision boundary between the two classes. Figure 3: Drawing the decision boundary 4. MATLAB Code %Import Sample Points From Text Files w1 = zeros(2,10); myfile = fopen('w1.txt','r'); w1 = fscanf(myfile,'%f %f',size(w1)); w1 = w1'; w2 = zeros(2,10); myfile = fopen('w2.txt','r'); w2 = fscanf(myfile,'%f %f',size(w2)); w2 = w2'; %Plotting The Sample Points title('Designing a Minimum Distance to Class Mean Classifier','FontName','Comic Sans MS'); hold on; p1 = plot(w1(:,1),w1(:,2),'h','MarkerEd geColor','r','LineWidth',1.5); hold on; p2 = plot(w2(:,1),w2(:,2),'h','MarkerEd geColor','g','LineWidth',1.5); xlabel('X1'); ylabel('X2'); %Calculating Class Mean y1 = [mean(w1(:,1)),mean(w1(:,2))] y2 = [mean(w2(:,1)),mean(w2(:,2))] %Plotting Class Mean hold on p3 = plot(y1(1),y1(2),'o','MarkerEdgeCo lor','r','LineWidth',1.5); hold on p4 = plot(y2(1),y2(2),'o','MarkerEdgeCo lor','g','LineWidth',1.5); %Points for testing sample = zeros(2,10); myfile = fopen('sample.txt','r'); sample = fscanf(myfile,'%f %f',size(sample)); sample = sample';
  • 4. 5. Result Analysis We have taken two datasets for result analysis. Each classes in datasets contains 10 sample values. Some of them are classified and some are not. For dataset 1, 4 samples out of 10 from class 1 are misclassified with respect to decision boundary. And all the training samples are classified correctly. So, the accuracy is 80%. Figure 4: Result analysis for dataset 1 Now for dataset 2, 2 samples out of 10 from class 1 and 3 samples out of 10 from class 2 are miss classified with respect to decision boundary. And all the training samples are classified correctly. So, the accuracy is 75%. Figure 5: Result analysis for dataset 2 %Calculating Linear Discriminant Function for i = 1:length(sample) g1 = sample(i,:)*y1'- .5*(y1*y1'); g2 = sample(i,:)*y2'- .5*(y2*y2'); if g1 > g2 plot(sample(i,1),sample(i,2),'x',' MarkerEdgeColor','r','LineWidth',1 .5); else plot(sample(i,1),sample(i,2),'x',' MarkerEdgeColor','g','LineWidth',1 .5); end end %Decision Boundary Between Two- classes coefficient = y1-y2; constant = -0.5*det((y1' * y1)- (y2' * y2)); b = [-4:2:8]; for i = 1:length(b) y(:,i) = -((coefficient(1,1)* b(:,i)+constant)/coefficient(1,2)) ; end d_boundary = [b',y']; plot(d_boundary(:,1),d_boundary(:, 2),'-.b'); hold off;
  • 5. 6. Conclusion In this assignment some sample are classified and some are misclassified. I want to apply this assignment in an easy away. It has simple calculation. So that the speed of this result is too efficient. The main weakness of this algorithm is its misclassification rate is higher because the boundary between two classes is linear.