<jupyter_start><jupyter_text>SLP TestExplorando classificador **Perceptron** com conjunto de dados da iris, seguindo o [tutorial](https://chrisalbon.com/machine_learning/basics/perceptron_in_scikit-learn/). Importando bibliotecas<jupyter_code>from sklearn.datasets import load_iris
from sklearn.linear_model import Perceptron
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report, plot_confusion_matrix<jupyter_output><empty_output><jupyter_text>Carregando _dataset_<jupyter_code>irisDS = load_iris()

X = irisDS.data
y = irisDS.target
irisDS.target_names<jupyter_output><empty_output><jupyter_text>Separando dados para treino e teste<jupyter_code>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=0)<jupyter_output><empty_output><jupyter_text>Pré-processando os dados de treino<jupyter_code># Train the scaler, which standarizes all the features to have mean=0 and unit variance
sc = StandardScaler()

sc.fit(X_train)
X_train_std = sc.transform(X_train)

X_test_std = sc.transform(X_test)<jupyter_output><empty_output><jupyter_text>Instanciando, treinando, testando e exibindo resultados do classificador<jupyter_code>classifier = Perceptron(max_iter=30, eta0=0.1, random_state=0)

classifier.fit(X_train_std, y_train)

y_pred = classifier.predict(X_test_std)

print('\n' + classification_report(y_test, y_pred, target_names=irisDS.target_names))

plot_confusion_matrix(
    estimator=classifier,
    X=X_test_std,
    y_true=y_test,
    display_labels=irisDS.target_names,
    normalize='true'
)<jupyter_output>precision    recall  f1-score   support

      setosa       1.00      1.00      1.00        16
  versicolor       0.94      0.94      0.94        18
   virginica       0.91      0.91      0.91        11

    accuracy                           0.96        45
   macro avg       0.95      0.95      0.95        45
weighted avg       0.96      0.96      0.96        45
{'fraction_non_alphanumeric': 0.08200795228628231, 'fraction_numerical': 0.0352882703777336, 'mean_word_length': 4.122137404580153, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '62510', 'license': 'MIT', 'n_tokens_mistral': 761, 'n_tokens_neox': 724, 'n_words': 137, 'path': 'ML/f00-sklearn_explore/02-slp/00-test.ipynb', 'repo_name': 'newtmagalhaes/Machine-Learning', 'size': '2012'}