Question: subject: machine learning using python Task 5: Run the example codes of Building Your First Model: K-Nearest Neighbors and Making predictions sections on the Juryter

subject: machine learning

using python

subject: machine learning using python Task 5: Run the example codes of

Task 5: Run the example codes of "Building Your First Model: K-Nearest Neighbors" and "Making predictions sections on the Juryter notebook at once as follows: from sklearn.neighbors import Kneighborsclassifier knn = KNeighborsClassifier (n_neighbors=1) knn.fit(x_train, y_train) X_new = np.array([[5, 2.9, 1, 0.2]]) print("x_new.shape: {}".Format(x_new.shape)) prediction = knn.predict(X_new) print("Prediction: {}".Format(prediction)) print("Predicted target name: {}".format( iris_dataset['target_names '][prediction])) a. Above example code predicts the input (X new) as class setosa. Change the values in X new.to observe when the model output different predictions (versicolor, or virginica). Find out which value has the highest impact on prediction. Include your code and results

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!