Question: 3 LDA [ 4 5 pts ] The binary LDA classification of x 2 2 was solved by finding the direction of the projection hyperplane
LDA pts
The binary LDA classification of was solved by finding the direction of the projection hyperplane
in the lecture. In this problem, the binary LDA classification model will be
trained and the train model will generalize the test data. Please display the results for the full credit
consideration.
Generate the data set and split it into train and test sets.
from sklearn import datasets
import numpy as np
X y datasets.makeblobsnsamples nfeatures centers
clusterstd randomstate
y nparray if i else for i in y
from sklearn.modelselection import traintestsplit
Xtrain, Xtest, ytrain, ytest traintestsplitX y
testsize randomstate
a Write a method that computes the betweenclass scatter matrix Compute using a
train data.
b pts Write a method that computes and returns the withinclass scatter of each class, the total
withinclass scatter and its inverse Calculate and using the train data.
c NumPy.linalg.eig
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
