Skip to content

Instantly share code, notes, and snippets.

@hucodelab
Created April 30, 2022 04:04
Show Gist options
  • Select an option

  • Save hucodelab/41a67083a51dca6e3b75c8f3f73cf7fc to your computer and use it in GitHub Desktop.

Select an option

Save hucodelab/41a67083a51dca6e3b75c8f3f73cf7fc to your computer and use it in GitHub Desktop.
# split the data
X_train, X_test, y_train, y_test = train_test_split(cancer.data, cancer.target, stratify=cancer.target)
# building and training the model
clf = KNeighborsClassifier(n_neighbors = 5)
clf.fit(X_train,y_train)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment