Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

do part C only Data used in Problems 1 and 2 X1train and X2train are training data points in Class 1 and 2, respectively. Xtest

do part C only

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Data used in Problems 1 and 2 X1train and X2train are training data points in Class 1 and 2, respectively. Xtest are testing data points to be classified into Class 1 and 2 . In the following expression, two-dimensional data points are represented in columns: X1train=[23324432545328460065]X2train=[716915101311119171313914111511141012]Xtest=[40102.51012.5] Problem 1 (a) (20 marks) Use the Gaussian Discriminant Analysis method to come up with a mathematical description of the decision boundary used to classify Class 1 and 2 . Use the training data to train the model and determine the decision boundary. Then classify each of the test points based on the posterior probabilities f(C1x) and f(C2x). In your submission, show the steps in your computation of the following items. Note that all calculations in Part (a) should be done by hand: i. : The prior probability of Class 1 ; ii. 1,2 : The mean vectors of the two classes; iii. S1,S2,S : The covariance matrices of the two classes and the mean covariance matrix; iv. w and w0 in the decision boundary equation: wTx+w0=0. b) (20 marks) Write a Python function called GaussianDiscriminantAnalysis to verify your calculation in Part (a). The function header should have the following form: def Gaussiandiscriminantanalysis (X1, X2) where data points in X1 and X2 are arranged in columns. In the function, codes should be written to (1) compute Item i, ii, iii and iv in Part (a) and the decision boundary and (2) plot of all the training data points with the decision boundary superimposed. You are encouraged to use the matlabplotlib.pyplot library for plotting. The function should be saved as an individual file named GaussiandiscriminantAnalysis.py and the codes written to implement the function should be copied and pasted to your report. (10 marks) Write scripts in a cell of the Jupyter Notebook file named Problem1.ipynb. In this script, you should: i. Train the model using the GaussianDiscriminantAnalysis function written in Part (b) using the training data. The value of each of Items i, ii, iii and iv listed in Part (a) should be made to display on the command window. These values should be copied and pasted to the report. All the plots generated in Python should be included in the report. ii. Classify the test data points into Class 1 and 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

here) and other areas you consider relevant.

Answered: 1 week ago