<jupyter_start><jupyter_text>MLP check for the classification task<jupyter_code>from sklearn.model_selection import train_test_split
from sklearn.datasets import make_moons, make_circles
from sklearn.externals import joblib

import matplotlib.pyplot as plt
from packages.plot import plot_contour, plot_ds
%matplotlib inline<jupyter_output><empty_output><jupyter_text>Load in the data<jupyter_code>ds = joblib.load('mlp_dataset.pkl')
X, y = ds
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.4)<jupyter_output><empty_output><jupyter_text>Data scalingYou must load and use the scaler that was generated during training.<jupyter_code># Don't cheat - load the scaler from file
scaler = joblib.load('mlp_scaler.pkl') 
# apply same transformation to data
X_train = scaler.transform(X_train)
X_test = scaler.transform(X_test)
plot_ds(X_train, X_test, y_train, y_test)<jupyter_output><empty_output><jupyter_text>Load the network<jupyter_code>net = joblib.load('mlp_net.pkl')<jupyter_output><empty_output><jupyter_text>Plot decision boundaryPlot the decision boundary as a contour plot. For that, we will assign a color to each point in the plane, which will be proportional to its probability of belonging to one class or the other.<jupyter_code>plot_contour(net, X_train, X_test, y_train, y_test)
plot_ds(X_train, X_test, y_train, y_test)<jupyter_output><empty_output><jupyter_text>Analysis of the networkPercentage of correct classification of the test data:<jupyter_code>print('Score: %.2f' % (net.score(X_test, y_test)*100))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08911521323997454, 'fraction_numerical': 0.003182686187141948, 'mean_word_length': 8.24705882352941, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '360637', 'license': 'MIT', 'n_tokens_mistral': 560, 'n_tokens_neox': 547, 'n_words': 138, 'path': 'MLP/mlp_classification_check.ipynb', 'repo_name': 'ecervera/nn-nb', 'size': '1571'}