|
17 | 17 | from sklearn.svm import LinearSVC |
18 | 18 | from sklearn.ensemble import RandomForestClassifier |
19 | 19 | from sklearn.naive_bayes import GaussianNB |
20 | | -from sklearn.datasets import load_iris, load_digits |
| 20 | +from sklearn.datasets import load_iris, load_digits, load_breast_cancer |
21 | 21 | from sklearn.model_selection import train_test_split |
22 | 22 | import pandas as pd |
23 | 23 | from CompStats.tests.test_performance import DATA |
24 | 24 |
|
25 | 25 |
|
| 26 | +def test_Perf_plot_col_wrap(): |
| 27 | + """Test plot when 2 classes""" |
| 28 | + from CompStats.metrics import f1_score |
| 29 | + |
| 30 | + X, y = load_breast_cancer(return_X_y=True) |
| 31 | + _ = train_test_split(X, y, test_size=0.3) |
| 32 | + X_train, X_val, y_train, y_val = _ |
| 33 | + ens = RandomForestClassifier().fit(X_train, y_train) |
| 34 | + nb = GaussianNB().fit(X_train, y_train) |
| 35 | + svm = LinearSVC().fit(X_train, y_train) |
| 36 | + score = f1_score(y_val, ens.predict(X_val), |
| 37 | + average=None, |
| 38 | + num_samples=50) |
| 39 | + score(nb.predict(X_val)) |
| 40 | + score(svm.predict(X_val)) |
| 41 | + score.plot() |
| 42 | + |
| 43 | + |
26 | 44 | def test_Difference_dataframe(): |
27 | 45 | """Test Difference dataframe""" |
28 | 46 | from CompStats.metrics import f1_score |
|
0 commit comments