Question: n this assignment, you will work with an Activity Recognition dataset to explore, preprocess, and apply various classification algorithms. You will build a Bayesian Classifier
n this assignment, you will work with an Activity Recognition dataset to explore, preprocess, and apply various classification algorithms. You will build a Bayesian Classifier from scratch and implement Kernel Discriminant Analysis KDA using different kernels. Additionally, you will apply multiple classifiers using the scikitlearn library on both the entire dataset and the PCAreduced dataset, comparing their performance.
Part : Data Preprocessing
Loading the Dataset:
Load the Activity Recognition dataset into a pandas DataFrame.Display the first few rows and check for any missing values.Handle missing values if necessary.
TrainTest Split:
Split the dataset into training and testing sets.Use an split, where of the data is used for training and for testing.
Part : Classification on the Entire Dataset
In this part, you will apply several classifiers to the entire dataset without any dimensionality reduction.
Bayesian Classifier from scratch:
Implement a Bayesian classifier by calculating the prior probabilities and modeling the likelihood with a Gaussian distribution.Use Bayes' Theorem to compute the posterior probability for each class and classify the test data.
Other Classifiers using scikitlearn: Apply the following classifiers from scikitlearn:
Support Vector Machine SVM:
Use both Linear SVM and Kernel SVM RBF and Polynomial kernels
kNearest Neighbors KNN:
Experiment with different values for k
Naive Bayes:
Implement Gaussian Naive Bayes using GaussianNB.
Linear Discriminant Analysis LDA:
Use LinearDiscriminantAnalysis.
Kernel Discriminant Analysis KDA:
Implement KDA using different kernels RBF Polynomial
Evaluation:
Evaluate the performance of all classifiers on the test set using the following metrics:
AccuracyPrecisionRecallFScore
Generate a confusion matrix for each classifier.
Part : Dimensionality Reduction Using PCA
Principal Component Analysis PCA:
Apply PCA to the dataset to reduce its dimensionality.Choose the number of components based on the explained variance ratio eg retain of the varianceVisualize the first two principal components.
Kernel PCA Optional:
Experiment with Kernel PCA using different kernels linear RBF polynomial and visualize the results.
Part : Classification on the PCAReduced Dataset
Now, apply the same classifiers used in Part to the PCAreduced dataset:
Bayesian Classifier from scratch:
Apply the Bayesian Classifier you built from scratch to the PCAreduced data.
Other Classifiers using scikitlearn:
Apply the following classifiers on the PCAreduced dataset:
Linear SVM and Kernel SVMkNearest Neighbors KNNNaive Bayes.Linear Discriminant Analysis LDAKernel Discriminant Analysis KDA
Evaluation:
Evaluate the classifiers again using the same metrics accuracy precision, recall, FscoreCompare their performance with and without PCA.
Part : Performance Comparison
Evaluation:
Create a summary table comparing the performance of all classifiers on the entire dataset and the PCAreduced dataset.Discuss how the classifiers performed with and without PCA.
Comparison and Discussion:
Compare the Bayesian classifier built from scratch to its scikitlearn counterparts.Analyze the impact of PCA on the classifiers performance.Discuss the effect of using different kernels in SVM and KDA.
Submission Instructions:
Submit your work in a Jupyter notebook named firstnamelastname.ipynb.
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
