Question: Week 9 - Exercise Notebook created by Jonathan Penava For this exercise you are going to try to try and predict the carat range of

Week 9- Exercise
Notebook created by Jonathan Penava
For this exercise you are going to try to try and predict the carat range of a diamond based on some of its properties. Start by importing the standard libraries and reading in the 'diamonds.csv' file.
Drop the 'Color', 'Clarity', and 'Unnamed: 0' Columns.
You will need to change the 'cut' values into int values.
Referencing what we did in week 5, create a new column for carat ranges with the values '0-1','1-2','2-3','3-4',4-5,'5-6'
Drop the column 'carat' after you have created the carat ranges column
Using K-Nearest Neighbours classify your carat ranges based on the other values in your dataframe. Print out an accuracy score and a classification report for your algorithm.
Create a diagram of error rates for different values of K . What value of K will give you a more accurate result?# Week 9- Exercise
### Notebook created by Jonathan Penava
For this exercise you are going to try to try and predict the carat range of a diamond based on some of its properties. Start by importing the standard libraries and reading in the 'diamonds.csv' file.
Drop the 'Color', 'Clarity', and 'Unnamed: 0' Columns.
You will need to change the 'cut' values into int values.
Referencing what we did in week 5, create a new column for carat ranges with the values '0-1','1-2','2-3','3-4','4-5','5-6'
Drop the column 'carat' after you have created the carat ranges column
Using K-Nearest Neighbours classify your carat ranges based on the other values in your dataframe. Print out an accuracy score and a classification report for your algorithm.
Create a diagram of error rates for different values of K. What value of K will give you a more accurate result?
 Week 9- Exercise Notebook created by Jonathan Penava For this exercise

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!