Advertisement
mayankjoin3

metrics new order k fold

Mar 17th, 2024
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. def result(y_pred,y_test,algo,start,end_train,end_predict):
  2. file.write(algo+",")
  3. file.write(str(format_decimal(end_train-start))+",")
  4. file.write(str(format_decimal(end_predict-end_train))+",")
  5. file.write(str(format_decimal(metrics.accuracy_score(y_test,y_pred)))+",")
  6. file.write(str(format_decimal(metrics.precision_score(y_test, y_pred, average='weighted')))+",")
  7. file.write(str(format_decimal(metrics.recall_score(y_test, y_pred, average='weighted')))+",")
  8. file.write(str(format_decimal(metrics.f1_score(y_test, y_pred, average='weighted')))+",")
  9. file.write(str(format_decimal(metrics.fbeta_score(y_test, y_pred,average='weighted', beta=0.5)))+",")
  10. file.write(str(format_decimal(metrics.matthews_corrcoef(y_test, y_pred)))+",")
  11. file.write(str(format_decimal(metrics.jaccard_score(y_test, y_pred, average='weighted')))+",")
  12. file.write(str(format_decimal(metrics.cohen_kappa_score(y_test, y_pred)))+",")
  13. file.write(str(format_decimal(metrics.hamming_loss(y_test, y_pred)))+",")
  14. file.write(str(format_decimal(metrics.zero_one_loss(y_test, y_pred)))+",")
  15. file.write(str(format_decimal(metrics.mean_absolute_error(y_test, y_pred)))+",")
  16. file.write(str(format_decimal(metrics.mean_squared_error(y_test, y_pred)))+",")
  17. file.write(str(format_decimal(np.sqrt(metrics.mean_squared_error(y_test, y_pred))))+",")
  18. file.write(str(format_decimal(metrics.balanced_accuracy_score(y_test, y_pred)))+",")
  19. 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