<jupyter_start><jupyter_text><jupyter_code>import pandas as pd
import sklearn
from sklearn import preprocessing
from sklearn.model_selection import train_test_split 
from sklearn.preprocessing import StandardScaler  
from sklearn.neural_network import MLPClassifier 
from sklearn.metrics import classification_report, confusion_matrix

url = "https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"

names = ['sepal-length', 'sepal-width', 'petal-length', 'petal-width', 'Class']
irisdata = pd.read_csv(url, names=names)
X = irisdata.iloc[:, 0:4]
y = irisdata.select_dtypes(include=[object])

X.head()
y.head()
y.Class.unique()
le = preprocessing.LabelEncoder()
y = y.apply(le.fit_transform)
y.head()
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.25)
scaler = StandardScaler()  
scaler.fit(X_train)
X_train = scaler.transform(X_train)  
X_test = scaler.transform(X_test)
mlp = MLPClassifier(hidden_layer_sizes=(10, 10, 10), max_iter=1000)  
mlp.fit(X_train, y_train.values.ravel())
predictions = mlp.predict(X_test)
print(predictions)
print(confusion_matrix(y_test,predictions))  
print(classification_report(y_test,predictions))<jupyter_output>[2 0 0 2 2 0 0 0 0 2 1 2 1 2 1 1 0 1 0 2 2 2 0 0 0 0 1 0 1 0 0 2 1 1 0 1 2
 0]
[[17  0  0]
 [ 0  6  1]
 [ 0  4 10]]
              precision    recall  f1-score   support

           0       1.00      1.00      1.00        17
           1       0.60      0.86      0.71         7
           2       0.91      0.71      0.80        14

    accuracy                           0.87        38
   macro avg       0.84      0.86      0.84        38
weighted avg       0.89      0.87      0.87        38
{'fraction_non_alphanumeric': 0.1032069970845481, 'fraction_numerical': 0.07405247813411078, 'mean_word_length': 2.466666666666667, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '112260', 'license': 'CC0-1.0', 'n_tokens_mistral': 706, 'n_tokens_neox': 635, 'n_words': 158, 'path': 'multilayerperceptron.ipynb', 'repo_name': 'vikaskumar04121998/practical-for-deep-learning', 'size': '1715'}