<jupyter_start><jupyter_text>Métricas de Regressão<jupyter_code>import pandas as pd
import numpy as np
import sklearn.metrics as metricas
X = [1, 3, 3]
y = [1, 4, 7]
y_pred = [3, 2, 4.5]

df = pd.DataFrame({ 'X': X, 'y': y, 'y_pred': y_pred })
df<jupyter_output><empty_output><jupyter_text>MAE<jupyter_code>metricas.mean_absolute_error(df['y'], df['y_pred'])
mae = (df['y'] - df['y_pred']).abs().sum() / df.shape[0]
mae<jupyter_output><empty_output><jupyter_text>MSE<jupyter_code>metricas.mean_squared_error(df['y'], df['y_pred'])
df.shape[0]
mse = ((df['y'] - df['y_pred'])**2).sum() / df.shape[0]
mse<jupyter_output><empty_output><jupyter_text>RMSE<jupyter_code>metricas.mean_squared_error(df['y'], df['y_pred'], squared=False)
rmse = np.sqrt(mse)
rmse
rmse = mse ** (1/2)
rmse<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2027194066749073, 'fraction_numerical': 0.019777503090234856, 'mean_word_length': 8.0, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '512485', 'license': 'CC0-1.0', 'n_tokens_mistral': 384, 'n_tokens_neox': 371, 'n_words': 57, 'path': '04-Metricas de Regressao.ipynb', 'repo_name': 'regispires/aulas-machine-learning-2022', 'size': '809'}