Question
1. Make a KNN program that can use data with an arbitrary number of features (1 or more). 2. (To test this, you can use
1. Make a KNN program that can use data with an arbitrary number of features (1 or more).
2. (To test this, you can use sklearn.datasets.make_blobs(n_features=3) to generate test data with 3 features, for example.)
3. Make your KNN program able to classify an arbitrary number of classes (2 or more).
4. Adapt your KNN program to use Manhattan distance. Are the results different? If so, what is different? Advanced: Do the same with Mahalanobis distance. Note: you will need to calculate the covariance matrix (you can use np.cov(X_train, rowvar=False)).
Please answer all these - as per standard practice, you can answer 4 as because all are related. Please answer all or ignore. Do not provide partial or wrong / copy answers.
Please don't provide the wrong java solution that is available in Chegg.
Answer in Python Code - use basic packages - Matlab, pyplot , Panda, NumPy and etc
Thanks in advance.
Step 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