Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please create a class and do not use the packages available. and for data set use any dummy data set Similar to assignment 1, you
Please create a class and do not use the packages available. and for data set use any dummy data set
Similar to assignment 1, you will need to create a class for eachiclassification method. These classes should implement both a predict and fit method. The fit method should take as input an ndarray of data samples and target values (the classes). It should then optimize the set of parameters foliowing the respective training method for that classification method. The predict method should takeas input an ndarray of samples topredict. For each classification method that is implemented, you will need to compare 3 variants of input features: 1. petal length/width 2. sepal length/width 3. all features For the first two, include visualizations of the classifier using plot_decision_regions from mlxtend (https://github.com/rasbt/mlxtend). This plotting function works with your trained classifier, assuming you have implemented a predict method. 2.1 Logistic Regression For the first classifier, implement a Eogisticceegression class. The fit method should use either the normal equations or gradient descent to come up with an optimal set of parameters. 2.2 Linear Discriminant Analysis The second model you will explore in this assigniment is Linear Discriminant Analysis. Implement both a fit and predict method following the details [https://dillhoffaj.utasites,cloud/posts/linear discriminant_analysis](described here.) The parameter update equations were derived via Maximum Likelihood Estimation and can be estimated directly from the data. You do not need to create a covariance matrix for each class. Instead, use a shared covariance matrix which is computed as =1k=1Knkk, where n-is the total number of samples, nk is the number of samples belonging to class k; and k is the covariance matrix for class k. 3. Testing For each trained model, compute the accuracy on the test set that was set aside for each data variant. In your notebook ciearly display the accuracies. Since there are 3 variants, there should be 3 comparisons of Logistic Regression versus LDAStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started