You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: quarto/CompStats.qmd
+8-14Lines changed: 8 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ pip install CompStats
35
35
```
36
36
:::
37
37
38
-
# Quick Start Guide
38
+
# scikit-learn Users
39
39
40
40
## Column
41
41
@@ -46,7 +46,8 @@ To illustrate the use of `CompStats`, the following snippets show an example. Th
46
46
47
47
from sklearn.svm import LinearSVC
48
48
from sklearn.naive_bayes import GaussianNB
49
-
from sklearn.ensemble import RandomForestClassifier, HistGradientBoostingClassifier
49
+
from sklearn.ensemble import RandomForestClassifier
50
+
from sklearn.ensemble import HistGradientBoostingClassifier
50
51
from sklearn.datasets import load_digits
51
52
from sklearn.model_selection import train_test_split
52
53
from sklearn.base import clone
@@ -65,25 +66,17 @@ m = LinearSVC().fit(X_train, y_train)
65
66
hy = m.predict(X_val)
66
67
```
67
68
68
-
## Column
69
-
70
69
Once the predictions are available, it is time to measure the algorithm's performance, as seen in the following code. It is essential to note that the API used in `sklearn.metrics` is followed; the difference is that the function returns an instance with different methods that can be used to estimate different performance statistics and compare algorithms.
71
70
71
+
## Column
72
+
72
73
```{python}
73
74
#| echo: true
74
75
75
76
score = f1_score(y_val, hy, average='macro')
76
77
score
77
78
```
78
79
79
-
The previous code shows the macro-f1 score and its standard error. The actual performance value is stored in the attributes `statistic` function, and `se`
80
-
81
-
```{python}
82
-
#| echo: true
83
-
84
-
score.statistic, score.se
85
-
```
86
-
87
80
Continuing with the example, let us assume that one wants to test another classifier on the same problem, in this case, a random forest, as can be seen in the following two lines. The second line predicts the validation set and sets it to the analysis.
88
81
89
82
```{python}
@@ -99,7 +92,8 @@ Let us incorporate another predictions, now with Naive Bayes classifier, and His
0 commit comments