Spaces:
Running
Running
Benjamin Bossan
commited on
Commit
•
0866d6f
1
Parent(s):
675701e
Show fit and scoring time
Browse files- index.html +9 -2
index.html
CHANGED
@@ -40,11 +40,18 @@ evaluate(clf)</code>
|
|
40 |
|
41 |
def evaluate(clf):
|
42 |
cv_result = cross_validate(clf, X, y, scoring='accuracy', cv=5)
|
43 |
-
|
|
|
|
|
44 |
print(f"Mean test accuracy: {mean(cv_result['test_score']):.3f}")
|
|
|
|
|
|
|
|
|
|
|
45 |
return tabulate.tabulate(show_result, tablefmt='html', headers='keys', floatfmt='.3')
|
46 |
</py-script>
|
47 |
|
48 |
-
<py-repl auto-generate="
|
49 |
</body>
|
50 |
</html>
|
|
|
40 |
|
41 |
def evaluate(clf):
|
42 |
cv_result = cross_validate(clf, X, y, scoring='accuracy', cv=5)
|
43 |
+
time_fit = sum(cv_result['fit_time'])
|
44 |
+
time_score = sum(cv_result['score_time'])
|
45 |
+
|
46 |
print(f"Mean test accuracy: {mean(cv_result['test_score']):.3f}")
|
47 |
+
print(f"Total training time: {time_fit:.1f} seconds")
|
48 |
+
print(f"Total time for scoring: {time_score:.1f} seconds")
|
49 |
+
|
50 |
+
show_result = {'split': [1, 2, 3, 4, 5], 'accuracy': cv_result['test_score']}
|
51 |
+
print("Accuracy for each cross validation split:")
|
52 |
return tabulate.tabulate(show_result, tablefmt='html', headers='keys', floatfmt='.3')
|
53 |
</py-script>
|
54 |
|
55 |
+
<py-repl auto-generate="true"></py-repl>
|
56 |
</body>
|
57 |
</html>
|