Posted: February 26th, 2022
Place your order now for a similar assignment and have exceptional work written by our team of experts, At affordable rates
For This or a Similar Paper Click To Order Now
Question 11
Train a knn model where k is 3 using the training dataset.
Make predictions using the test dataset
Compute accuracy and save as accuracy
Hints:
You need to use the KNeighborsClassifier function. Instantiate a knn object and pass the number of neighbors to the function. Train the model using the X_train and y_train. Then make predictions using X_test. Then compute the accuracy using the predicted values and y_test.
Check Module 6d: Model Performance and _Module 5c: Classification
Question 12
Train a Random Forests model where the number of estimators is 100 using the training dataset.
Make predictions using the test dataset
Compute accuracy and save as accuracy
Hints:
You need to use the RandomForestClassifier function. Instantiate a RandomForestClassifier object and pass the number of estimators to the function. Train the model using the X_train and y_train. Then make predictions using X_test. Then compute the accuracy using the predicted values and y_test.
Check Module 6d: Model Performance and _Module 5c: Classification
Place an order in 3 easy steps. Takes less than 5 mins.