Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve this in r software on the basis of Pima Dataset. In the `MASS` library, combine the two datasets `Pima.te` and `Pima.tr` back into

Please solve this in r software on the basis of Pima Dataset.

In the `MASS` library, combine the two datasets `Pima.te` and `Pima.tr` back into one complete dataset, call it `pima`. (Try function `rbind()`.) How many observations are there?

**Train-Test split 3:1**

In order to perform KNN analysis, we need to separate the X-variables and the y-labels. (Which should be our y-variable?) Before we separate them out, create vector/array of 1 and 2 to create train-test split in the ratio of 3:1. (Set a constant seed value so that we can duplicate the results.) So eventually, you will get the training Xs as a dataframe, training y-label (a vector), as well as the test sets together in four groups. Make sure the train-X and train-y are not mixed up in the ordering during the process. Same for test-X and test-y.

**KNN results**

Perform the KNN analysis, with different k values. You do not need to show all the results from different k, but please include the one with the best (total) accuracy in your submission. How does the accuracy compared to the percentages of being T/F in the dataset?

Perform knn in Pima Dataset .

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Finite Math And Applied Calculus

Authors: Stefan Waner, Steven Costenoble

2nd Edition

0534366309, 9780534366308

More Books

Students also viewed these Mathematics questions

Question

Newtons second law says So is a force? Explain.

Answered: 1 week ago