<jupyter_start><jupyter_text>Title<jupyter_code># Aplicando machine learning em base de dados do kaggle<jupyter_output><empty_output><jupyter_text>Head<jupyter_code># fonte de dados: https://www.kaggle.com/dell4010/wine-dataset/data
# estudando machine learning by geanclm em 20/02/2022 at 11:47h<jupyter_output><empty_output><jupyter_text>Import libs<jupyter_code>import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv('wine_dataset.csv')
df.head()
df.shape
df.info()
df['style']
df['style'] = df['style'].replace('red', 0)
df['style'] = df['style'].replace('white', 1)
df.head()
y = df['style']
X = df.drop('style', axis = 1)
y
X
X.shape
y.shape
from sklearn.model_selection import train_test_split as tts
X_tr, X_ts, y_tr, y_ts = tts(X,y, test_size= 0.3)
# aplicando algorítmo de machine learning de classificação
from sklearn.ensemble import ExtraTreesClassifier
modelo = ExtraTreesClassifier()
modelo.fit(X_tr, y_tr)
resultado = modelo.score(X_ts, y_ts)
print("Acurácia:", resultado)
y_ts[400:403]
X_ts[400:403]
previsoes = modelo.predict(X_ts[400:403])
print(previsoes)<jupyter_output>[1 0 1]
{'fraction_non_alphanumeric': 0.1393884892086331, 'fraction_numerical': 0.03776978417266187, 'mean_word_length': 7.3059701492537314, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '227022', 'license': 'MIT', 'n_tokens_mistral': 483, 'n_tokens_neox': 449, 'n_words': 94, 'path': 'ML_vinhos_csv.ipynb', 'repo_name': 'geanclm/machine-learning', 'size': '1112'}