Analise o script python abaixo:import pandas as pdfrom sklea...
Analise o script python abaixo:
import pandas as pd
from sklearn.datasets import make_hastie_10_2
x, y = make_hastie_10_2(n_samples=6000,
random_state=42)
from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(x,
y, test_size=0.25,
random_state=42)
from sklearn.ensemble import RandomForestClassifier
clf = RandomForestClassifier( n_estimators=100,
oob_score=True, n_jobs=-1)
clf.fit(x_train, y_train)
y_pred_proba = clf.predict_proba(x_test)[:,1]
from sklearn.metrics import roc_curve
fpr, tpr, thr = roc_curve(y_test, y_pred_proba)
pd.DataFrame( {'FPR': fpr, 'TPR': tpr}
).set_index('FPR')['TPR'].plot(kind='line')
O gráfico plotado como resultado do processamento do script é