SlideShare ist ein Scribd-Unternehmen logo
1 von 11
Downloaden Sie, um offline zu lesen
Ahsanullah
University of Science
& Technology
Designing a minimum
distance to class mean
classifier
Name : Mufakkharul Islam Nayem
ID : 12.01.04.150
Year & Semester : 4th
2nd
Section : C (C-2)
Assignment 1
Course Title : Pattern Recognition LAB
Course ID : CSE 4214
Date of Submission - December 26, 2015

DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 1
Introduction
“Minimum Distance to Class Mean Classifier” is used to classify unclassified sample
vectors where the vectors clustered in more than one classes are given. For example, in a
dataset containing n sample vectors of dimension d some given sample vectors are already
clustered into classes and some are not. We can classify the unclassified sample vectors with
Class Mean Classifier.
Task
Given the following two-class set of prototypes:
Dataset 1:
w1 = {(2 -1),(3 0),(3 2),(-1-3),(4 1),(-2 -4),(0 -1),(-2 2),(-1 -4),(-4 1)} [input file class1_dataset1.txt]
w2 = {(0 0),(-2 1),(-1 -1),(-4 4),(-4 1),(2 6),(2 2),(3 1),(3 -1),(-1 -3)} [input file class1_dataset1.txt]
Dataset 2:
w1 = {(2 -1),(3 0),(3 2),(-1-3),(4 1),(-2 -4),(0 -1),(-2 2),(-1 -4),(-4 1)} [input file class1_dataset2.txt]
w2 = {(0 0),(-2 1),(-1 -1),(-4 4),(-4 1),(2 6),(2 2),(3 1),(3 -1),(-1 -3)} [input file class2_dataset2.txt]
Dataset 3:
w1 = {(2 -1),(3 0),(3 2),(-1-3),(4 1),(-2 -4),(0 -1),(-2 2),(-1 -4),(-4 1)} [input file class1_dataset3.txt]
w2 = {(0 0),(-2 1),(-1 -1),(-4 4),(-4 1),(2 6),(2 2),(3 1),(3 -1),(-1 -3)} [input file class1_dataset3.txt]
1. Plot all sample points from both classes, but samples from the same class should have the
same color and marker.
2. 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 = (5 2)
X2 = (2 -4)
X3 = (-1 8)
DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 2
X4 = (-2 -3)
X5 = (-2 -12)
X6 = (-10 6) ; [input file testsample.txt]
Linear Discriminant Function:
!
3. Draw the decision boundary between the two-classes.
Solution
• Plotting two-class set of prototypes
Two classes in each dataset were given. Firstly I plotted all the points. Samples from
the same class were plotted using the same color and marker so that different classes can be
distinguished easily. Here blue stars ‘*’ represent class 1 and red stars ‘*’ represent class 2.
• Calculating the distance from the mean of each class using Linear Discriminant
Function
The mean points of the two classes are calculated & plotted with same class color with
the ‘+’ marker (‘+’ for class 1 & ‘+’ for class 2).
Now for each of the point (X1…X6), I calculated the distance from the mean of each
class using Linear Discriminant Function:
!
Further derivation of the linear discriminant function:
I used the discriminant function in the form, !
so, for the two classes (w1, w2) the function becomes,
!
gi (x) = XT
Yi − 1
2 Yi
T
Yi
gi (x) = XT
Yi − 1
2 Yi
T
Yi
gi (x) = wi
T
x − 1
2 wi
T
wi
g1(x) = w1
T
x − 1
2 w1
T
w1
g2 (x) = w2
T
x − 1
2 w2
T
w2
DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 3
The points were assigned to the class with minimum distance from the respected class
mean. I used the same class color but different marker while plotting those points. Here the
circles ‘o’ are the given test samples (‘o’ for class 1 & ‘o’ for class 2).
• Drawing the decision boundary between the two-classes
Decision boundary between the two classes is to be drawn now. For finding out this
boundary I considered all possible points within the range considering those points as over
the boundary line whose distance from both the classes is same. However, I used minimum &
maximum values of x1 to calculate x2 using the following function for the approximate
boundary between the two classes:
!
From this formula I have derived the linear equation to find the decision boundary co-
ordinates for plotting them in the figure. The equation that I derived is,
! ; [here ! ]
Here ‘.-’ line created with orange color (.-.-.-.-) represents the linear decision boundary
between the two classes.
g(x) = g1(x)− g2 (x)
= w1
T
x − 1
2 w1
T
w1 − w2
T
x + 1
2 w2
T
w2
= (w1
T
− w2
T
)x − 1
2 (w1
T
w1 − w2
T
w2 )
(w1
T
− w2
T
)x − 1
2 (w1
T
w1 − w2
T
w2 ) = 0
⇒ COEF1 COEF2( ) x1
x2
⎛
⎝
⎜
⎞
⎠
⎟ + CONSTANT = 0
⇒ COEF1 × x1 + COEF1 × x2 + CONSTANT = 0
⇒ x2 =
COEF1 × x1 + CONSTANT
−COEF2
CONSTANT = − 1
2 (w1
T
w1 − w2
T
w2 )
DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 4
Accuracy Discussion
For the 3 datasets figures for each of them is given below,
For dataset 1,
• 2 samples (out of 10) from class 1 & 3 samples (out of 10) from class 2 are misclassified with
respect to decision boundary.
• All the training samples are classified correctly.
• Accuracy is 75%
DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 5
For dataset 2,
• 6 samples (out of 20) from class 1 & 8 samples (out of 20) from class 2 are misclassified with
respect to decision boundary.
• All the training samples are classified correctly.
• Accuracy is 65%
DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 6
For dataset 3,
• 15 samples (out of 30) from class 1 & 12 samples (out of 30) from class 2 are misclassified
with respect to decision boundary.
• All the training samples are classified correctly.
• Accuracy is 55%
So, from the observation I can say that as sample data increases the classification rate &
accuracy of the decision boundary decreases. But training sample classification is more
accurate.
DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 7
Matlab Code
function CMCfinal()
clear
clc
%Given Sample Points
w1=zeros(2,10);
myfile = fopen(‘class1_dataset1.txt','r'); %for dataset2 use
class1_dataset3.txt &
dataset3 use
class1_dataset3.txt
w1 = fscanf(myfile,'%f %f',size(w1));
w1=w1’;
w2=zeros(2,10);
myfile = fopen(‘class2_dataset2.txt','r'); %for dataset2 use
class2_dataset3.txt &
dataset3 use
class2_dataset3.txt
w2 = fscanf(myfile,'%f %f',size(w2));
w2=w2';
%Plotting the Sample Points
figure
title('Minimum Distance to Class Mean Classifier');
hold on
L1=plot(w1(:,1),w1(:,2),'*','MarkerEdgeColor','b');
hold on;
L2=plot(w2(:,1),w2(:,2),'*','MarkerEdgeColor','r');
xlabel('X1');
ylabel('X2');
DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 8
%Calculating mean of two classes
y1 = [ mean(w1(:,1)) mean(w1(:,2))];
y2 = [ mean(w2(:,1)) mean(w2(:,2))];
%Plotting mean of two classes
hold on
L3=plot(y1(1),y1(2),'+','MarkerEdgeColor','b');
hold on
L4=plot(y2(1),y2(2),'+','MarkerEdgeColor','r');
%Points for testing
x=zeros(2,6);
myfile = fopen('testsample.txt','r');
x = fscanf(myfile,'%f %f',size(x));
x=x';
% For n number of test samples, calculating Linear Discriminant
Function
for n = 1:length(x)
g1=x(n,:)*y1'-.5*(y1*y1');
g2=x(n,:)*y2’-.5*(y2*y2');
if g1>g2
hold on
L5=plot(x(n,1),x(n,2),'o','MarkerEdgeColor','b');
else
hold on
L6=plot(x(n,1),x(n,2),'o','MarkerEdgeColor','r');
end
end
DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 9
% Calculate decision boundary between two classes
minw=min(min(w1(:)),min(w2(:)));
minall=min(minw,min(x(:)));
maxw=max(max(w1(:)),max(w2(:)));
maxall=max(maxw,max(x(:)));
DBx1 = minall:0.1:maxall;
coefficient=(y1-y2);
constant=-0.5*det((y1'*y1-y2'*y2));
for i=1:length(DBx1)
DBx2(i,:) = (coefficient(1,1)*DBx1(:,i)+constant)/
(-coefficient(1,2));
end
%{
for i=1:length(DBx)
DBx2(i,1) = (3*DBx1(1,i)+7.0312)/(1.5);
end
%}
DB = [DBx1' DBx2];
hold on
L7=plot(DB(:,1),DB(:,2),'.-');
legend([L1 L2 L3 L4 L5 L6 L7],{'Class 1','Class 2','Class 1
Mean','Class 2 Mean','Class 1 Test','Class 2
Test','Decision Boundary'},'location','northoutside');
hold off;
DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 10
Conclusion
I tried to implement the algorithm in a simple way. No complex calculations were
made. The weakness of the algorithm is its misclassification rate is relatively higher because
the boundary between the two classes is linear.
DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 11

Weitere ähnliche Inhalte

Was ist angesagt?

Mining Frequent Patterns, Association and Correlations
Mining Frequent Patterns, Association and CorrelationsMining Frequent Patterns, Association and Correlations
Mining Frequent Patterns, Association and CorrelationsJustin Cletus
 
Classification in data mining
Classification in data mining Classification in data mining
Classification in data mining Sulman Ahmed
 
Back propagation
Back propagationBack propagation
Back propagationNagarajan
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysisMahesh Bhalerao
 
Image restoration and degradation model
Image restoration and degradation modelImage restoration and degradation model
Image restoration and degradation modelAnupriyaDurai
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer GraphicsKamal Acharya
 
data generalization and summarization
data generalization and summarization data generalization and summarization
data generalization and summarization janani thirupathi
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesFahim Ferdous
 
Learning set of rules
Learning set of rulesLearning set of rules
Learning set of rulesswapnac12
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)swapnac12
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)Timbal Mayank
 
Decision Tree Learning
Decision Tree LearningDecision Tree Learning
Decision Tree LearningMilind Gokhale
 
Computational Learning Theory
Computational Learning TheoryComputational Learning Theory
Computational Learning Theorybutest
 
Inductive analytical approaches to learning
Inductive analytical approaches to learningInductive analytical approaches to learning
Inductive analytical approaches to learningswapnac12
 
weak slot and filler structure
weak slot and filler structureweak slot and filler structure
weak slot and filler structureAmey Kerkar
 
Character generation techniques
Character generation techniquesCharacter generation techniques
Character generation techniquesMani Kanth
 
lazy learners and other classication methods
lazy learners and other classication methodslazy learners and other classication methods
lazy learners and other classication methodsrajshreemuthiah
 

Was ist angesagt? (20)

PAC Learning
PAC LearningPAC Learning
PAC Learning
 
Mining Frequent Patterns, Association and Correlations
Mining Frequent Patterns, Association and CorrelationsMining Frequent Patterns, Association and Correlations
Mining Frequent Patterns, Association and Correlations
 
Classification in data mining
Classification in data mining Classification in data mining
Classification in data mining
 
Back propagation
Back propagationBack propagation
Back propagation
 
Object oriented analysis
Object oriented analysisObject oriented analysis
Object oriented analysis
 
Image restoration and degradation model
Image restoration and degradation modelImage restoration and degradation model
Image restoration and degradation model
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
Image compression models
Image compression modelsImage compression models
Image compression models
 
data generalization and summarization
data generalization and summarization data generalization and summarization
data generalization and summarization
 
BackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and ExamplesBackTracking Algorithm: Technique and Examples
BackTracking Algorithm: Technique and Examples
 
Learning set of rules
Learning set of rulesLearning set of rules
Learning set of rules
 
Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)Performance analysis(Time & Space Complexity)
Performance analysis(Time & Space Complexity)
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
 
Decision Tree Learning
Decision Tree LearningDecision Tree Learning
Decision Tree Learning
 
Computational Learning Theory
Computational Learning TheoryComputational Learning Theory
Computational Learning Theory
 
Inductive analytical approaches to learning
Inductive analytical approaches to learningInductive analytical approaches to learning
Inductive analytical approaches to learning
 
weak slot and filler structure
weak slot and filler structureweak slot and filler structure
weak slot and filler structure
 
Character generation techniques
Character generation techniquesCharacter generation techniques
Character generation techniques
 
lazy learners and other classication methods
lazy learners and other classication methodslazy learners and other classication methods
lazy learners and other classication methods
 
Histogram Equalization
Histogram EqualizationHistogram Equalization
Histogram Equalization
 

Andere mochten auch

Pattern Recognition: Class mean classifier
Pattern Recognition: Class mean classifierPattern Recognition: Class mean classifier
Pattern Recognition: Class mean classifierMd Mamunur Rashid
 
Designing A Minimum Distance to Class Mean Classifier
Designing A Minimum Distance to Class Mean ClassifierDesigning A Minimum Distance to Class Mean Classifier
Designing A Minimum Distance to Class Mean ClassifierMd. Toufique Hasan
 
Ann chapter-3-single layerperceptron20021031
Ann chapter-3-single layerperceptron20021031Ann chapter-3-single layerperceptron20021031
Ann chapter-3-single layerperceptron20021031frdos
 
Object Recognition: Fourier Descriptors and Minimum-Distance Classification
Object Recognition: Fourier Descriptors and Minimum-Distance ClassificationObject Recognition: Fourier Descriptors and Minimum-Distance Classification
Object Recognition: Fourier Descriptors and Minimum-Distance ClassificationCody Ray
 
International Journal of Image Processing and Pattern Recognition vol 2 issue 1
International Journal of Image Processing and Pattern Recognition vol 2 issue 1International Journal of Image Processing and Pattern Recognition vol 2 issue 1
International Journal of Image Processing and Pattern Recognition vol 2 issue 1JournalsPub www.journalspub.com
 
nural network ER. Abhishek k. upadhyay
nural network ER. Abhishek  k. upadhyaynural network ER. Abhishek  k. upadhyay
nural network ER. Abhishek k. upadhyayabhishek upadhyay
 
Pattern recognition for UX - 13 April 2013
Pattern recognition for UX - 13 April 2013Pattern recognition for UX - 13 April 2013
Pattern recognition for UX - 13 April 2013amelio
 
Fields of digital image processing slides
Fields of digital image processing slidesFields of digital image processing slides
Fields of digital image processing slidesSrinath Dhayalamoorthy
 
Applications of Digital image processing in Medical Field
Applications of Digital image processing in Medical FieldApplications of Digital image processing in Medical Field
Applications of Digital image processing in Medical FieldAshwani Srivastava
 
Pattern recognition and Machine Learning.
Pattern recognition and Machine Learning.Pattern recognition and Machine Learning.
Pattern recognition and Machine Learning.Rohit Kumar
 
Biomedical image processing ppt
Biomedical image processing pptBiomedical image processing ppt
Biomedical image processing pptPriyanka Goswami
 

Andere mochten auch (15)

Pattern Recognition: Class mean classifier
Pattern Recognition: Class mean classifierPattern Recognition: Class mean classifier
Pattern Recognition: Class mean classifier
 
Designing A Minimum Distance to Class Mean Classifier
Designing A Minimum Distance to Class Mean ClassifierDesigning A Minimum Distance to Class Mean Classifier
Designing A Minimum Distance to Class Mean Classifier
 
Ann chapter-3-single layerperceptron20021031
Ann chapter-3-single layerperceptron20021031Ann chapter-3-single layerperceptron20021031
Ann chapter-3-single layerperceptron20021031
 
Object Recognition: Fourier Descriptors and Minimum-Distance Classification
Object Recognition: Fourier Descriptors and Minimum-Distance ClassificationObject Recognition: Fourier Descriptors and Minimum-Distance Classification
Object Recognition: Fourier Descriptors and Minimum-Distance Classification
 
International Journal of Image Processing and Pattern Recognition vol 2 issue 1
International Journal of Image Processing and Pattern Recognition vol 2 issue 1International Journal of Image Processing and Pattern Recognition vol 2 issue 1
International Journal of Image Processing and Pattern Recognition vol 2 issue 1
 
nural network ER. Abhishek k. upadhyay
nural network ER. Abhishek  k. upadhyaynural network ER. Abhishek  k. upadhyay
nural network ER. Abhishek k. upadhyay
 
Application of image processing
Application of image processingApplication of image processing
Application of image processing
 
Pattern recognition for UX - 13 April 2013
Pattern recognition for UX - 13 April 2013Pattern recognition for UX - 13 April 2013
Pattern recognition for UX - 13 April 2013
 
CSC446: Pattern Recognition (LN8)
CSC446: Pattern Recognition (LN8)CSC446: Pattern Recognition (LN8)
CSC446: Pattern Recognition (LN8)
 
Fields of digital image processing slides
Fields of digital image processing slidesFields of digital image processing slides
Fields of digital image processing slides
 
Applications of Digital image processing in Medical Field
Applications of Digital image processing in Medical FieldApplications of Digital image processing in Medical Field
Applications of Digital image processing in Medical Field
 
Pattern Recognition
Pattern RecognitionPattern Recognition
Pattern Recognition
 
Introduction to pattern recognition
Introduction to pattern recognitionIntroduction to pattern recognition
Introduction to pattern recognition
 
Pattern recognition and Machine Learning.
Pattern recognition and Machine Learning.Pattern recognition and Machine Learning.
Pattern recognition and Machine Learning.
 
Biomedical image processing ppt
Biomedical image processing pptBiomedical image processing ppt
Biomedical image processing ppt
 

Ähnlich wie Pattern Recognition - Designing a minimum distance class mean classifier

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
 
Implementing Minimum Error Rate Classifier
Implementing Minimum Error Rate ClassifierImplementing Minimum Error Rate Classifier
Implementing Minimum Error Rate ClassifierDipesh Shome
 
maXbox starter67 machine learning V
maXbox starter67 machine learning VmaXbox starter67 machine learning V
maXbox starter67 machine learning VMax Kleiner
 
Implementation of K-Nearest Neighbor Algorithm
Implementation of K-Nearest Neighbor AlgorithmImplementation of K-Nearest Neighbor Algorithm
Implementation of K-Nearest Neighbor AlgorithmDipesh Shome
 
CLUSTER ANALYSIS ALGORITHMS.pptx
CLUSTER ANALYSIS ALGORITHMS.pptxCLUSTER ANALYSIS ALGORITHMS.pptx
CLUSTER ANALYSIS ALGORITHMS.pptxShwetapadmaBabu1
 
Lecture_3_k-mean-clustering.ppt
Lecture_3_k-mean-clustering.pptLecture_3_k-mean-clustering.ppt
Lecture_3_k-mean-clustering.pptSyedNahin1
 
Application of combined support vector machines in process fault diagnosis
Application of combined support vector machines in process fault diagnosisApplication of combined support vector machines in process fault diagnosis
Application of combined support vector machines in process fault diagnosisDr.Pooja Jain
 
Soạn thảo văn bản bằng LATEX
Soạn thảo văn bản bằng LATEXSoạn thảo văn bản bằng LATEX
Soạn thảo văn bản bằng LATEXHuỳnh Lâm
 
CLIQUE Automatic subspace clustering of high dimensional data for data mining...
CLIQUE Automatic subspace clustering of high dimensional data for data mining...CLIQUE Automatic subspace clustering of high dimensional data for data mining...
CLIQUE Automatic subspace clustering of high dimensional data for data mining...Raed Aldahdooh
 
Lecture on linerar discriminatory analysis
Lecture on linerar discriminatory analysisLecture on linerar discriminatory analysis
Lecture on linerar discriminatory analysisdevcb13d
 
Principal Components Analysis, Calculation and Visualization
Principal Components Analysis, Calculation and VisualizationPrincipal Components Analysis, Calculation and Visualization
Principal Components Analysis, Calculation and VisualizationMarjan Sterjev
 
Aaa ped-17-Unsupervised Learning: Dimensionality reduction
Aaa ped-17-Unsupervised Learning: Dimensionality reductionAaa ped-17-Unsupervised Learning: Dimensionality reduction
Aaa ped-17-Unsupervised Learning: Dimensionality reductionAminaRepo
 
The Positive Effects of Fuzzy C-Means Clustering on Supervised Learning Class...
The Positive Effects of Fuzzy C-Means Clustering on Supervised Learning Class...The Positive Effects of Fuzzy C-Means Clustering on Supervised Learning Class...
The Positive Effects of Fuzzy C-Means Clustering on Supervised Learning Class...CSCJournals
 

Ähnlich wie Pattern Recognition - Designing a minimum distance class mean classifier (20)

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
 
Lda
LdaLda
Lda
 
Implementing Minimum Error Rate Classifier
Implementing Minimum Error Rate ClassifierImplementing Minimum Error Rate Classifier
Implementing Minimum Error Rate Classifier
 
maXbox starter67 machine learning V
maXbox starter67 machine learning VmaXbox starter67 machine learning V
maXbox starter67 machine learning V
 
Implementation of K-Nearest Neighbor Algorithm
Implementation of K-Nearest Neighbor AlgorithmImplementation of K-Nearest Neighbor Algorithm
Implementation of K-Nearest Neighbor Algorithm
 
CLUSTER ANALYSIS ALGORITHMS.pptx
CLUSTER ANALYSIS ALGORITHMS.pptxCLUSTER ANALYSIS ALGORITHMS.pptx
CLUSTER ANALYSIS ALGORITHMS.pptx
 
Lecture_3_k-mean-clustering.ppt
Lecture_3_k-mean-clustering.pptLecture_3_k-mean-clustering.ppt
Lecture_3_k-mean-clustering.ppt
 
Application of combined support vector machines in process fault diagnosis
Application of combined support vector machines in process fault diagnosisApplication of combined support vector machines in process fault diagnosis
Application of combined support vector machines in process fault diagnosis
 
Mod mean quartile
Mod mean quartileMod mean quartile
Mod mean quartile
 
Soạn thảo văn bản bằng LATEX
Soạn thảo văn bản bằng LATEXSoạn thảo văn bản bằng LATEX
Soạn thảo văn bản bằng LATEX
 
CLIQUE Automatic subspace clustering of high dimensional data for data mining...
CLIQUE Automatic subspace clustering of high dimensional data for data mining...CLIQUE Automatic subspace clustering of high dimensional data for data mining...
CLIQUE Automatic subspace clustering of high dimensional data for data mining...
 
K Means Clustering in ML.pptx
K Means Clustering in ML.pptxK Means Clustering in ML.pptx
K Means Clustering in ML.pptx
 
Feature Selection
Feature Selection Feature Selection
Feature Selection
 
Lecture on linerar discriminatory analysis
Lecture on linerar discriminatory analysisLecture on linerar discriminatory analysis
Lecture on linerar discriminatory analysis
 
K mean-clustering
K mean-clusteringK mean-clustering
K mean-clustering
 
Practice test1 solution
Practice test1 solutionPractice test1 solution
Practice test1 solution
 
ICPR 2016
ICPR 2016ICPR 2016
ICPR 2016
 
Principal Components Analysis, Calculation and Visualization
Principal Components Analysis, Calculation and VisualizationPrincipal Components Analysis, Calculation and Visualization
Principal Components Analysis, Calculation and Visualization
 
Aaa ped-17-Unsupervised Learning: Dimensionality reduction
Aaa ped-17-Unsupervised Learning: Dimensionality reductionAaa ped-17-Unsupervised Learning: Dimensionality reduction
Aaa ped-17-Unsupervised Learning: Dimensionality reduction
 
The Positive Effects of Fuzzy C-Means Clustering on Supervised Learning Class...
The Positive Effects of Fuzzy C-Means Clustering on Supervised Learning Class...The Positive Effects of Fuzzy C-Means Clustering on Supervised Learning Class...
The Positive Effects of Fuzzy C-Means Clustering on Supervised Learning Class...
 

Kürzlich hochgeladen

Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxPurva Nikam
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 

Kürzlich hochgeladen (20)

Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptx
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 

Pattern Recognition - Designing a minimum distance class mean classifier

  • 1. Ahsanullah University of Science & Technology Designing a minimum distance to class mean classifier Name : Mufakkharul Islam Nayem ID : 12.01.04.150 Year & Semester : 4th 2nd Section : C (C-2) Assignment 1 Course Title : Pattern Recognition LAB Course ID : CSE 4214 Date of Submission - December 26, 2015
 DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 1
  • 2. Introduction “Minimum Distance to Class Mean Classifier” is used to classify unclassified sample vectors where the vectors clustered in more than one classes are given. For example, in a dataset containing n sample vectors of dimension d some given sample vectors are already clustered into classes and some are not. We can classify the unclassified sample vectors with Class Mean Classifier. Task Given the following two-class set of prototypes: Dataset 1: w1 = {(2 -1),(3 0),(3 2),(-1-3),(4 1),(-2 -4),(0 -1),(-2 2),(-1 -4),(-4 1)} [input file class1_dataset1.txt] w2 = {(0 0),(-2 1),(-1 -1),(-4 4),(-4 1),(2 6),(2 2),(3 1),(3 -1),(-1 -3)} [input file class1_dataset1.txt] Dataset 2: w1 = {(2 -1),(3 0),(3 2),(-1-3),(4 1),(-2 -4),(0 -1),(-2 2),(-1 -4),(-4 1)} [input file class1_dataset2.txt] w2 = {(0 0),(-2 1),(-1 -1),(-4 4),(-4 1),(2 6),(2 2),(3 1),(3 -1),(-1 -3)} [input file class2_dataset2.txt] Dataset 3: w1 = {(2 -1),(3 0),(3 2),(-1-3),(4 1),(-2 -4),(0 -1),(-2 2),(-1 -4),(-4 1)} [input file class1_dataset3.txt] w2 = {(0 0),(-2 1),(-1 -1),(-4 4),(-4 1),(2 6),(2 2),(3 1),(3 -1),(-1 -3)} [input file class1_dataset3.txt] 1. Plot all sample points from both classes, but samples from the same class should have the same color and marker. 2. 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 = (5 2) X2 = (2 -4) X3 = (-1 8) DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 2
  • 3. X4 = (-2 -3) X5 = (-2 -12) X6 = (-10 6) ; [input file testsample.txt] Linear Discriminant Function: ! 3. Draw the decision boundary between the two-classes. Solution • Plotting two-class set of prototypes Two classes in each dataset were given. Firstly I plotted all the points. Samples from the same class were plotted using the same color and marker so that different classes can be distinguished easily. Here blue stars ‘*’ represent class 1 and red stars ‘*’ represent class 2. • Calculating the distance from the mean of each class using Linear Discriminant Function The mean points of the two classes are calculated & plotted with same class color with the ‘+’ marker (‘+’ for class 1 & ‘+’ for class 2). Now for each of the point (X1…X6), I calculated the distance from the mean of each class using Linear Discriminant Function: ! Further derivation of the linear discriminant function: I used the discriminant function in the form, ! so, for the two classes (w1, w2) the function becomes, ! gi (x) = XT Yi − 1 2 Yi T Yi gi (x) = XT Yi − 1 2 Yi T Yi gi (x) = wi T x − 1 2 wi T wi g1(x) = w1 T x − 1 2 w1 T w1 g2 (x) = w2 T x − 1 2 w2 T w2 DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 3
  • 4. The points were assigned to the class with minimum distance from the respected class mean. I used the same class color but different marker while plotting those points. Here the circles ‘o’ are the given test samples (‘o’ for class 1 & ‘o’ for class 2). • Drawing the decision boundary between the two-classes Decision boundary between the two classes is to be drawn now. For finding out this boundary I considered all possible points within the range considering those points as over the boundary line whose distance from both the classes is same. However, I used minimum & maximum values of x1 to calculate x2 using the following function for the approximate boundary between the two classes: ! From this formula I have derived the linear equation to find the decision boundary co- ordinates for plotting them in the figure. The equation that I derived is, ! ; [here ! ] Here ‘.-’ line created with orange color (.-.-.-.-) represents the linear decision boundary between the two classes. g(x) = g1(x)− g2 (x) = w1 T x − 1 2 w1 T w1 − w2 T x + 1 2 w2 T w2 = (w1 T − w2 T )x − 1 2 (w1 T w1 − w2 T w2 ) (w1 T − w2 T )x − 1 2 (w1 T w1 − w2 T w2 ) = 0 ⇒ COEF1 COEF2( ) x1 x2 ⎛ ⎝ ⎜ ⎞ ⎠ ⎟ + CONSTANT = 0 ⇒ COEF1 × x1 + COEF1 × x2 + CONSTANT = 0 ⇒ x2 = COEF1 × x1 + CONSTANT −COEF2 CONSTANT = − 1 2 (w1 T w1 − w2 T w2 ) DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 4
  • 5. Accuracy Discussion For the 3 datasets figures for each of them is given below, For dataset 1, • 2 samples (out of 10) from class 1 & 3 samples (out of 10) from class 2 are misclassified with respect to decision boundary. • All the training samples are classified correctly. • Accuracy is 75% DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 5
  • 6. For dataset 2, • 6 samples (out of 20) from class 1 & 8 samples (out of 20) from class 2 are misclassified with respect to decision boundary. • All the training samples are classified correctly. • Accuracy is 65% DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 6
  • 7. For dataset 3, • 15 samples (out of 30) from class 1 & 12 samples (out of 30) from class 2 are misclassified with respect to decision boundary. • All the training samples are classified correctly. • Accuracy is 55% So, from the observation I can say that as sample data increases the classification rate & accuracy of the decision boundary decreases. But training sample classification is more accurate. DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 7
  • 8. Matlab Code function CMCfinal() clear clc %Given Sample Points w1=zeros(2,10); myfile = fopen(‘class1_dataset1.txt','r'); %for dataset2 use class1_dataset3.txt & dataset3 use class1_dataset3.txt w1 = fscanf(myfile,'%f %f',size(w1)); w1=w1’; w2=zeros(2,10); myfile = fopen(‘class2_dataset2.txt','r'); %for dataset2 use class2_dataset3.txt & dataset3 use class2_dataset3.txt w2 = fscanf(myfile,'%f %f',size(w2)); w2=w2'; %Plotting the Sample Points figure title('Minimum Distance to Class Mean Classifier'); hold on L1=plot(w1(:,1),w1(:,2),'*','MarkerEdgeColor','b'); hold on; L2=plot(w2(:,1),w2(:,2),'*','MarkerEdgeColor','r'); xlabel('X1'); ylabel('X2'); DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 8
  • 9. %Calculating mean of two classes y1 = [ mean(w1(:,1)) mean(w1(:,2))]; y2 = [ mean(w2(:,1)) mean(w2(:,2))]; %Plotting mean of two classes hold on L3=plot(y1(1),y1(2),'+','MarkerEdgeColor','b'); hold on L4=plot(y2(1),y2(2),'+','MarkerEdgeColor','r'); %Points for testing x=zeros(2,6); myfile = fopen('testsample.txt','r'); x = fscanf(myfile,'%f %f',size(x)); x=x'; % For n number of test samples, calculating Linear Discriminant Function for n = 1:length(x) g1=x(n,:)*y1'-.5*(y1*y1'); g2=x(n,:)*y2’-.5*(y2*y2'); if g1>g2 hold on L5=plot(x(n,1),x(n,2),'o','MarkerEdgeColor','b'); else hold on L6=plot(x(n,1),x(n,2),'o','MarkerEdgeColor','r'); end end DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 9
  • 10. % Calculate decision boundary between two classes minw=min(min(w1(:)),min(w2(:))); minall=min(minw,min(x(:))); maxw=max(max(w1(:)),max(w2(:))); maxall=max(maxw,max(x(:))); DBx1 = minall:0.1:maxall; coefficient=(y1-y2); constant=-0.5*det((y1'*y1-y2'*y2)); for i=1:length(DBx1) DBx2(i,:) = (coefficient(1,1)*DBx1(:,i)+constant)/ (-coefficient(1,2)); end %{ for i=1:length(DBx) DBx2(i,1) = (3*DBx1(1,i)+7.0312)/(1.5); end %} DB = [DBx1' DBx2]; hold on L7=plot(DB(:,1),DB(:,2),'.-'); legend([L1 L2 L3 L4 L5 L6 L7],{'Class 1','Class 2','Class 1 Mean','Class 2 Mean','Class 1 Test','Class 2 Test','Decision Boundary'},'location','northoutside'); hold off; DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 10
  • 11. Conclusion I tried to implement the algorithm in a simple way. No complex calculations were made. The weakness of the algorithm is its misclassification rate is relatively higher because the boundary between the two classes is linear. DESIGNING A MINIMUM DISTANCE TO CLASS MEAN CLASSIFIER 11