Answers for "predict method sklearn"

0

predict method sklearn

from sklearn import neighbors, datasets
iris = datasets.load_iris()
X, y = iris.data, iris.target
knn = neighbors.KNeighborsClassifier(n_neighbors=1)
knn.fit(X, y)
# What kind of iris has 3cm x 5cm sepal and 4cm x 2cm petal?
print(iris.target_names[knn.predict([[3, 5, 4, 2]])])
Posted by: Guest on September-02-2020

Code answers related to "predict method sklearn"

Python Answers by Framework

Browse Popular Code Answers by Language