<jupyter_start><jupyter_text>KNN on IRIS DatasetSaket TiwariDate: 15 June 2019<jupyter_code>import numpy as np
from sklearn.datasets import load_iris
dataset=load_iris()
dataset.keys()
dataset['target_names']
from sklearn.model_selection import train_test_split
X_train,X_test,y_train,y_test=train_test_split(dataset['data'],dataset['target'])
from sklearn.neighbors import KNeighborsClassifier
for k in range(1,10):
    neigh=KNeighborsClassifier(k)
    neigh.fit(X_train,y_train)
    print(neigh.score(X_test,y_test)*100)<jupyter_output>97.36842105263158
94.73684210526315
97.36842105263158
97.36842105263158
97.36842105263158
97.36842105263158
100.0
97.36842105263158
100.0
{'fraction_non_alphanumeric': 0.09467455621301775, 'fraction_numerical': 0.1952662721893491, 'mean_word_length': 8.81159420289855, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '143892', 'license': 'MIT', 'n_tokens_mistral': 351, 'n_tokens_neox': 266, 'n_words': 42, 'path': 'K-Nearest Neighbour/KNN on IRIS.ipynb', 'repo_name': 'saket-iiitR/Machine-Learning-Works', 'size': '676'}