PYTHON

profileLITTLE
CSCI333.FinalProject_Part2.docx

CSCI 333.01W

Final Project (10% of Final Grade)

Part II

50 points

Due date: 4/22/2020 Thu. by 11:59pm

Overview

The Final project consists of two Parts. This is Part 2.

Part 2. Classification with k-Nearest Neighbors and the Digits Dataset

The goal of project Part 2 is

1) Get started with machine learning

2) Learn the algorithms of k-Nearest Neighbors with the Digits dataset for recognizing handwritten digits

1. Study the slides “14_MachineLearning.pdf” for week14, and run the python program “CaseStudy.ipynb” step by step along with the slides, to understand the steps in a Typical Data Science study.

2. Rewrite a python program (“machinelearning_yourname.ipynb”) by doing the following tasks:

a. (3 pts) Write code to display the two-dimensional array representing the sample image at index 50, as well as the numeric (target) value of the digit the image represents

b. (3 pts) Write code to display the image of the sample image at index 50 of the Digits dataset.

c. (4 pts) Write code to explore and display the digit datasets images from index 50 to 90 in a 5 row, 8 column Figure.

d. (3 pts) For the digits dataset, what numbers of samples would the following statement reserve for training and testing purposes? Write code to get and display these numbers

e. (4 pts) Create the knn model with default k or your choice of k. Hint: set keyword n_neighbors as your preferred number in KNeighborsClassifier(n_neighbors=k).

f. (3 pts) Train the model, predict Digit Classes

g. (4 pts) Rewrite the list comprehension in snippet [21] in CaseStudy.ipynb (or the same line in CaseStudy.py) using a for loop. Hint: create an empty list and then use the built-in function “append”.

h. (3 pts) Output the mismatches (cases where the predicted and expected values do not match).

i. (3 pts) Calculate and display model accuracy

Grading Rubric:

· 30 points for finishing Part2 Task a - i

· 10 points for a runnable python program (in .ipynb format) with correct data visualization

· 5 points for appropriate comments / Markdown

· 5 points for screenshots of the program(s) as well as step by step results in a .docx document

· 5 bonus points for on-time submission

What to Submit:

1. One doc file “csci333-FinalProject-Part2-YourFirstNameLastName.docx", including the text source code or screenshot of the source code, and screenshots of the outputs of your program(s). Hopefully, based on these screen snapshots of the outputs, you can show that your programs passed tests and were well.

2. Your python file (.ipynb format). In well-defined programs, proper comments are required. For programs without comments, some points will be deducted.

3. Note that if your program or code does not work, you can explain the status of the program or

code and then attach your explanation and description in your word document.

Submission Example:

· csci333-FinalProjectPart2-YanLi.docx

· FinalProjectPart2_YanLi.ipynb

2