Skip to content

Instantly share code, notes, and snippets.

Gonzalo Ruiz de Villa gonzaloruizdevilla

  • GFT
  • Madrid, Spain
Block or report user

Report or block gonzaloruizdevilla

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View iris14.py
print("Test set score (knn.score): {:.2f}".format(knn.score(X_test, y_test)))
View iris13.py
y_pred = knn.predict(X_test)
print("Test set predictions:\n {}".format(y_pred))
print("Test set score (np.mean): {:.2f}".format(np.mean(y_pred == y_test)))
View iris12.py
prediction = knn.predict(X_new)
print("Prediction: {}".format(prediction))
print("Predicted target name: {}".format(iris_dataset['target_names'][prediction]))
View iris11.py
X_new = np.array([[5, 2.9, 1, 0.2]])
print("X_new.shape: {}".format(X_new.shape))
View iris9.py
knn = KNeighborsClassifier(n_neighbors=1)
View iris8.py
print("X_test shape: {}".format(X_test.shape))
print("y_test shape: {}".format(y_test.shape))
View iris7.py
print("X_train shape: {}".format(X_train.shape))
print("y_train shape: {}".format(y_train.shape))
View iris6.py
X_train, X_test, y_train, y_test = train_test_split(iris_dataset['data'],iris_dataset['target'], random_state=0)
View iris5.py
print("Type of target: {}".format(type(iris_dataset['target'])))
print("Shape of target: {}".format(iris_dataset['target'].shape))
print("Target:\n{}".format(iris_dataset['target']))
You can’t perform that action at this time.