i need a help on python

timer Asked: Apr 23rd, 2017

Question description








Buy using the above datasets calculate and compare the accuracy between KNN Accuracy and 10-fold Cross-validation with Logistic Regression.

Solve the following cases before calculating the accuracy.

  1. Import the sklearn library for all the datasets.
  2. Read the data for all the datasets and normalize them.
  3. For the athletes dataset replace the data of column Sport with 0, 1 and 2 accordingly. (For example 0 for Gymnastics, 1 for Basketball and 2 for Track). For the Iris dataset replace the data of column Species with 0, 1 and 2 accordingly. (For example 0 for Iris-setosa, 1 for Iris-versicolor and 2 for Iris-virginica). For the mpg dataset replace the data of column Model with 0,1, 2 and so on accordingly.(For example 0 for chevrolet chevelle malibu, 1 for buick skylark 320 and so on).
  4. Define the predictions and print them for all datasets.
  5. Create a classifier to search for an optimal value of K for KNN Algorithm for cross-validation accuracy.
  6. Plot the value of K for KNN Versus the cross-validation accuracy.
  7. Print out the KNN accuracy and 10-fold cross-validation with logistic regression and compare them.

All of the functions that you need for this system are given inside the notebook Cross-validation.ipynb in Module 10 of your class sessions.

You will need to test how accurate your classification system is by running your model on the test sets ( Explanation in detail is given in the Zacharski Chapter4)

You should submit / upload one IPython Notebook file ( .ipynb )

Tutor Answer

(Top Tutor) Studypool Tutor
School: Rice University
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors