Created
November 26, 2017 12:37
-
-
Save joao-timescale/0d617b219ffdb13dd980332c0a5b606d to your computer and use it in GitHub Desktop.
KNN Dataset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.datasets import load_digits | |
import matplotlib.pyplot as plt | |
# Load data set and corresponding labels | |
digits_data = load_digits() | |
digits = digits_data.data | |
labels = digits_data.target | |
class_names = digits_data.target_names | |
# Partition data set into training and test data sets | |
train_data_ratio = 0.75 # test_data_ratio = 1 - train_data_ratio | |
train_data_idx = int(train_data_ratio * digits.shape[0]) | |
train_data = digits[:train_data_idx] | |
train_data_labels = labels[:train_data_idx] | |
test_data = digits[train_data_idx:] | |
test_data_labels = labels[train_data_idx:] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment