Difference between revisions of "UBISS2024exam"
Jump to navigation
Jump to search
Line 3: | Line 3: | ||
# | # | ||
# | # | ||
− | from sklearn. | + | from everywhereml.sklearn.ensemble import RandomForestClassifier |
#Comment here: | #Comment here: | ||
# | # | ||
# | # | ||
− | + | max_leaf_nodes = 30 | |
+ | |||
+ | |||
+ | #Comment here: | ||
+ | # | ||
+ | # | ||
+ | clf = RandomForestClassifier(n_estimators=100, max_leaf_nodes=max_leaf_nodes) | ||
#Comment here: | #Comment here: | ||
# | # | ||
# | # | ||
− | + | clf.fit(X_train, y_train) | |
#Comment here: | #Comment here: | ||
# | # | ||
# | # | ||
− | + | print(f'Score: {clf.score(X_test, y_test):3.3f}') | |
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 12:40, 13 June 2024
1 #Comment here:
2 #
3 #
4 from everywhereml.sklearn.ensemble import RandomForestClassifier
5
6 #Comment here:
7 #
8 #
9 max_leaf_nodes = 30
10
11
12 #Comment here:
13 #
14 #
15 clf = RandomForestClassifier(n_estimators=100, max_leaf_nodes=max_leaf_nodes)
16
17 #Comment here:
18 #
19 #
20 clf.fit(X_train, y_train)
21
22 #Comment here:
23 #
24 #
25 print(f'Score: {clf.score(X_test, y_test):3.3f}')