{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# 2A.ML101.5: Measuring prediction performance"]}, {"cell_type": "markdown", "metadata": {}, "source": ["*Source:* [Course on machine learning with scikit-learn](https://github.com/GaelVaroquaux/sklearn_ensae_course) by Ga\u00ebl Varoquaux"]}, {"cell_type": "markdown", "metadata": {}, "source": ["## Using the K-neighbors classifier"]}, {"cell_type": "markdown", "metadata": {}, "source": ["Here we'll continue to look at the digits data, but we'll switch to the\n", "K-Neighbors classifier. The K-neighbors classifier is an instance-based\n", "classifier. The K-neighbors classifier predicts the label of\n", "an unknown point based on the labels of the *K* nearest points in the\n", "parameter space."]}, {"cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": ["# Get the data\n", "from sklearn.datasets import load_digits\n", "digits = load_digits()\n", "X = digits.data\n", "y = digits.target"]}, {"cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [{"data": {"text/html": ["
KNeighborsClassifier(n_neighbors=1)In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
KNeighborsClassifier(n_neighbors=1)