<jupyter_start><jupyter_text>Here are some important libraries<jupyter_code>import pandas as pd
import numpy as np<jupyter_output><empty_output><jupyter_text>loading iris function<jupyter_code>From sklearn.datasets import load_iris
iris_dataset = load_iris()<jupyter_output><empty_output><jupyter_text>iris object containing keys and values.<jupyter_code>print(“keys of iris_dataset: \n{}”.format(iris_dataset.key()))
keys of iris_dataset:
dist_keys(['data','target','target_names','DESCR','features_names','filename'])<jupyter_output><empty_output><jupyter_text>Lets see what key DESCR contains<jupyter_code>print(iris_dataset['DESCR'][:193]+"\n....")
..iris_dataset:
iris plants dataset
..........
**dataset of characteristics:**
:Number of Instances:150(50 in each of three classes)
:Numbers of Attributes:4 numeric,pre
.........<jupyter_output><empty_output><jupyter_text>The value of key target_names<jupyter_code>print("Target names:{}".format(iris_dataset['target_names']))
Target names:['setosa','Versicolor','virginica']<jupyter_output><empty_output><jupyter_text>The value of feature_name<jupyter_code>print('features names:\n{}'.format(iris_data['features_names']))
feature_names:
['Sepal lenght(cm)','Sepal Width(cm)','petal lenght(cm)','petal width(cm)']<jupyter_output><empty_output><jupyter_text>numpy array<jupyter_code>print("type of data {}".format(type(iris_dataset['data'])))
type of data:<class 'numpy.ndarray'><jupyter_output><empty_output><jupyter_text>shape of data<jupyter_code>print("Shape of data: {}".format(iris_dataset['data'].shape))
shape of data:(150,4)<jupyter_output><empty_output><jupyter_text>Data representation<jupyter_code>print("First Five colums of data: \n{}".format(iris_dataset['data'][:5]))
First five colums of data
[[5.1 3.5 1.4 0.2]
 [4.9 3.0 1.4 0.2]
 [4.7 3.2 1.3 0.2]
 [4.6 3.1 1.5 0.2]
 [5.0 3.6 1.4 0.2]]<jupyter_output><empty_output><jupyter_text>Types of Target<jupyter_code>print("tpye of target:{}".format(type(iris_dataset['target']))
Type of target: <class 'numpy.ndarray'><jupyter_output><empty_output><jupyter_text>Shape of Target<jupyter_code>print("Shape of target:{}".format(iris_dataset['target']))
shape of Target:(150, )<jupyter_output><empty_output><jupyter_text>Result<jupyter_code>print("Target:\n{}".format(iris_dataset['target']))<jupyter_output><empty_output><jupyter_text>Testing of Data<jupyter_code>From sklearn.model_selection import train_test_split
X_train, X_test, Y_train, Y_test = train_test_spilt(
    iris_dataset['data'],iris_dataset['target'], random_state =0)<jupyter_output><empty_output><jupyter_text>X_train = 75% and X_test = 25%<jupyter_code>print("X_train Shape:{}".format(X_train.shape))
print("Y_train Shape:{}".format(Y_train.shape))
print("X_test Shape:{}".format(X_test.shape))
print("Y_test Shape:{}".format(Y_test.shape))

X_train shape :(112,4)
Y_train shape :(112, )
X_test shape :(38,4)
Y_test shape :(38, )<jupyter_output><empty_output><jupyter_text>Machine Learning Model(Bot)<jupyter_code>From sklearn.neighbors import KNeighborsClassifier
Knn = KKNeighborsClassifier(n_neighbors = 1)
Knn.Fit(X_train,Y_train)
KNeighborsClassifier(algorithms = 'auto',leaf_size = 30, metric = 
                     'minkowski',metric_params = none,
                     n_jobs = None, n_neighbors = 1, p  =2, Weight = 'uniform')<jupyter_output><empty_output><jupyter_text>Making Predictions<jupyter_code>X_new = np.array([[5, 2.9, 1, 0.2]])
print("X_new.shape:{}".format(X_new.shape))
X_new.shape :(1,4)
prediction = Knn.predict(X_new)
print("prediction:{}".format(prediction))
print("predictiontarget_name :{}".format(iris_dataset['target_names']
                                         [prediction]))
prediction:[0]
prediction target name :['Setosa']<jupyter_output><empty_output><jupyter_text>Evaluation<jupyter_code>Y_pred = Knn.predict(X_test)
print("TEst Set prediction :\n{}".format(Y_pred))
TEst set prediction:
[2 1 0 2 0 2 0 1 1 1 2 1 1 1 1 0 1 1 0 0 2 1 0 0 2 0 0 1 1 0 2 1 0 2 2 1 0 2]
print("Test set score: {}".format(np.mean(Y_pred == y_test)))
Test set score: 0.9736842105263158<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15726290516206481, 'fraction_numerical': 0.034333733493397356, 'mean_word_length': 6.920152091254753, 'pattern_counts': {'":': 0, '<': 71, '<?xml version=': 0, '>': 71, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '17', 'dir': 'jupyter-structured-clean-dedup', 'id': '82857', 'license': 'RSA-MD', 'n_tokens_mistral': 1682, 'n_tokens_neox': 1578, 'n_words': 271, 'path': 'Rudramadhaba_mishra.ipynb', 'repo_name': 'RUDRAMADHABA/DSC-30-Days-of-Web', 'size': '4165'}