-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresults-svm.xml
71 lines (65 loc) · 4.36 KB
/
results-svm.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="3" skipped="0" tests="14" time="37.189" timestamp="2023-05-10T00:12:43.602295" hostname="P-212-122001"><testcase classname="test_svm" name="test_missing_data_X" time="0.048" /><testcase classname="test_svm" name="test_missing_data_Y" time="0.001" /><testcase classname="test_svm" name="test_imbalanced_labels" time="0.002" /><testcase classname="test_svm" name="test_train_score" time="3.030" /><testcase classname="test_svm" name="test_train_predict" time="3.174"><failure message="AssertionError: y_pred is not equal to y_test assert 1 == 2 + where 1 = int(array([1], dtype=int64))">dataset = ( Use CaseType ... Packet Delay Budget (Latency)
0 1 ... 5
1 ... ..
63163 3
63164 3
63165 3
63166 3
63167 3
Name: Slice Type (Output), Length: 63168, dtype: int64)
def test_train_predict(dataset):
# Test that the model can fit the data
model = LinearSVC(random_state=42)
X, y = dataset
print(X.shape)
model.fit(X, y)
X_test, y_test = generate_stochastic_data()
y_pred = model.predict(X_test.reshape(1, -1))
> assert int(y_pred)==y_test, "y_pred is not equal to y_test"
E AssertionError: y_pred is not equal to y_test
E assert 1 == 2
E + where 1 = int(array([1], dtype=int64))
test_svm.py:75: AssertionError</failure></testcase><testcase classname="test_svm" name="test_evaluation_accuracy" time="3.191" /><testcase classname="test_svm" name="test_evaluation_precision" time="3.149" /><testcase classname="test_svm" name="test_evaluation_recall" time="3.323" /><testcase classname="test_svm" name="test_evaluation_f1" time="3.156" /><testcase classname="test_svm" name="test_evaluation_mse" time="3.176" /><testcase classname="test_svm" name="test_evaluation_rmse" time="3.218" /><testcase classname="test_svm" name="test_evaluation_auc" time="3.223"><failure message="AssertionError: AUC is 0.0, expected 0.92 or higher assert 0.0 >= 0.92 + where 0.0 = round(0.0, 2)">dataset = ( Use CaseType ... Packet Delay Budget (Latency)
0 1 ... 5
1 ... ..
63163 3
63164 3
63165 3
63166 3
63167 3
Name: Slice Type (Output), Length: 63168, dtype: int64)
def test_evaluation_auc(dataset):
X, y = dataset
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
y_train_binarized = label_binarize(y_train, classes=[1, 2, 3])
y_test_binarized = label_binarize(y_test, classes=[1, 2, 3])
model = LinearSVC(random_state=42)
model.fit(X, y)
y_pred = model.predict(X_test)
#pred_prob = model.predict_proba(X_test)
auc = roc_auc_score(y_test_binarized, y_pred.reshape(-1,1), multi_class='ovr')
> assert round(auc, 2) >= 0.92, f"AUC is {auc}, expected 0.92 or higher"
E AssertionError: AUC is 0.0, expected 0.92 or higher
E assert 0.0 >= 0.92
E + where 0.0 = round(0.0, 2)
test_svm.py:142: AssertionError</failure></testcase><testcase classname="test_svm" name="test_evaluation_mae" time="3.103" /><testcase classname="test_svm" name="test_evaluation_kappa" time="3.068"><failure message="AssertionError: Cohen's Kappa Score is 1.0, expected 0.67 or lower assert 1.0 <= 0.67 + where 1.0 = round(1.0, 2)">dataset = ( Use CaseType ... Packet Delay Budget (Latency)
0 1 ... 5
1 ... ..
63163 3
63164 3
63165 3
63166 3
63167 3
Name: Slice Type (Output), Length: 63168, dtype: int64)
def test_evaluation_kappa(dataset):
X, y = dataset
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
model = LinearSVC(random_state=42)
model.fit(X, y)
y_pred = model.predict(X_test)
kappa = cohen_kappa_score(y_test, y_pred)
> assert round(kappa, 2) <= 0.67, f"Cohen's Kappa Score is {kappa}, expected 0.67 or lower"
E AssertionError: Cohen's Kappa Score is 1.0, expected 0.67 or lower
E assert 1.0 <= 0.67
E + where 1.0 = round(1.0, 2)
test_svm.py:160: AssertionError</failure></testcase></testsuite></testsuites>