Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def result(y_pred,y_test,algo,start,end_train,end_predict):
- file.write(algo+",")
- file.write(str(format_decimal(end_train-start))+",")
- file.write(str(format_decimal(end_predict-end_train))+",")
- file.write(str(format_decimal(metrics.accuracy_score(y_test,y_pred)))+",")
- file.write(str(format_decimal(metrics.precision_score(y_test, y_pred, average='weighted')))+",")
- file.write(str(format_decimal(metrics.recall_score(y_test, y_pred, average='weighted')))+",")
- file.write(str(format_decimal(metrics.f1_score(y_test, y_pred, average='weighted')))+",")
- file.write(str(format_decimal(metrics.fbeta_score(y_test, y_pred,average='weighted', beta=0.5)))+",")
- file.write(str(format_decimal(metrics.matthews_corrcoef(y_test, y_pred)))+",")
- file.write(str(format_decimal(metrics.jaccard_score(y_test, y_pred, average='weighted')))+",")
- file.write(str(format_decimal(metrics.cohen_kappa_score(y_test, y_pred)))+",")
- file.write(str(format_decimal(metrics.hamming_loss(y_test, y_pred)))+",")
- file.write(str(format_decimal(metrics.zero_one_loss(y_test, y_pred)))+",")
- file.write(str(format_decimal(metrics.mean_absolute_error(y_test, y_pred)))+",")
- file.write(str(format_decimal(metrics.mean_squared_error(y_test, y_pred)))+",")
- file.write(str(format_decimal(np.sqrt(metrics.mean_squared_error(y_test, y_pred))))+",")
- file.write(str(format_decimal(metrics.balanced_accuracy_score(y_test, y_pred)))+",")
- file.write(str(format_decimal(metrics.explained_variance_score(y_test, y_pred)*100))+"\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement