[SOLVED] PatternRecognition Assignment2

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Assignment-2-y7u0ts.zip (1934.8 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
πŸ”’ Securely Powered by:
Secure Checkout
5/5 - (1 vote)

Deliverables for this assignment:

  1. Programming Assignment (MATLAB or Python)
  2. Code file and output screenshots for all. You can make use of built in command to find the covariance matrix, where normalization is done using 1/ n-1.

Q1. Find and plot the decision boundary between class Ο‰1 and Ο‰2. Assume P(Ο‰1) = P(Ο‰2).

 

Ο‰1 = [1,6; 3,4; 3,8; 5,6]

Ο‰2 = [3,0; 1,-2;3,-4;5,-2]

Q2. Find and plot the decision boundary between class Ο‰1 and Ο‰2. Assume P(Ο‰1) =0.3; P(Ο‰2)=0.7

Ο‰1 = [1,-1; 2,-5; 3,-6; 4,-10; 5,-12; 6,-15]

Ο‰2 = [-1,1; -2,5; -3,6; -4,10, -5,12; -6, 15]

Q3. Find and plot the decision boundary between class Ο‰1 and Ο‰2. Assume P(Ο‰1) = P(Ο‰2).

Ο‰1 = [2,6; 3,4; 3,8; 4,6]

Ο‰2 = [3,0; 1,-2; 3,-4; 5,-2]

Q4. Implement Bayes Classifier for Iris Dataset.

Dataset Specifications:

Total number of samples = 150

Number of classes = 3 (Iris setosa, Iris virginica, and Iris versicolor) Number of samples in each class = 50

 

Use the following information to design classifier:

 

Number of training feature vectors ( first 40 in each class)Β  = 40

Number of test feature vectors ( remaining 10 in each class) = 10

Number of dimensions = 4

Feature vector = <sepal length, sepal width, petal length, petal width>

 

If the samples follow a multivariate normal density, find the accuracy of classification for the test feature vectors.

Q5. Use only two features: Petal Length and Petal Width, for 3 class classification and draw the decision boundary between them (2 dimension, 3 regions also called as multi-class problem)

Q6. Consider the 128- dimensional feature vectors given in the β€œface feature vectors.csv” file. Use this information to design and implement a Bayes Classifier.

Dataset Specifications:

Total number of samples = 800

Number of classes = 2 ( labelled as β€œmale” and β€œfemale”)

Samples from β€œ1 to 400”  belongs to class β€œmale”

Samples from β€œ401 to 800” belongs to class β€œfemale”

Number of samples per class = 400

 

Use the following information to design classifier:

 

Number of test feature vectors ( first 5 in each class)Β  = 5

Number of training feature vectors ( remaining 395 in each class) = 395Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  Number of dimensions = 128

 

Design of Bayes Classifier

 

Given,

Iris dataset

𝑋 =< π‘₯1 , π‘₯2, π‘₯3, π‘₯4 >

Number of classes= πœ”1, πœ”2, πœ”3 ;Β  c=3

N=150; n(πœ”1)=n(πœ”1)=n(πœ”1)=50 Bayes Rule:

 

Find 𝑃(πœ”π‘–|𝑋) = 𝑃(𝑋|πœ”π‘ƒ(𝑖𝑋)).𝑃(πœ”π‘–)

 

𝑃(𝑋) is a constant for all classes; so it can be ignored.

Steps to follow in Iris Classification:

  1. Find apriori probability 𝑃(πœ”π‘–) = 𝑛(π‘πœ”π‘–) =
  2. Find 𝑃(𝑋|πœ”π‘–), Β it’s multivariate class, by following normal density

 

𝑃(𝑋|πœ”π‘–) = Β (2πœ‹)𝑑/21 |𝛴𝑖|1/2 𝑒π‘₯𝑝 [βˆ’ Β {(𝑋 βˆ’ ¡𝑖)π‘‘π›΄π‘–βˆ’1(𝑋 βˆ’ ¡𝑖)}]

 

2 a. Find the mean vector

2 b. Find the covariance matrix, 𝛴𝑖

2 c. Find the |𝛴𝑖| and |𝛴𝑖|βˆ’1

  1. Find 𝑃(πœ”1|𝑋), 𝑃(πœ”2|𝑋) π‘Žπ‘›π‘‘ 𝑃(πœ”3|𝑋). Β Find the maximum and assign 𝑋 to that class. Also, plot the accuracy for :Β  Β Β Β Β Β Β Β  i) Separate classesΒ  Β Β Β Β  ii) Overall performance
  2. Find the discriminant function and draw the decision surface between the classes.

 

 

 

Note: The same steps can be followed for Q6.

******************************************************************************

 

  • Assignment-2-y7u0ts.zip