fix: 🧪 Fix tests with new scikit-learn version

This commit is contained in:
Ricardo Montañana Gómez
2023-01-14 21:31:34 +01:00
parent 7ef88bd5c7
commit 6dc3a59df8
13 changed files with 35 additions and 34 deletions

View File

@@ -46,7 +46,7 @@ def main(args_test=None):
'{"C": 7, "gamma": 0.1, "kernel": "rbf", "multiclass_strategy": '
'"ovr"}',
'{"C": 5, "kernel": "rbf", "gamma": "auto"}',
'{"C": 0.05, "max_iter": 10000.0, "kernel": "liblinear", '
'{"C": 0.05, "max_iter": 10000, "kernel": "liblinear", '
'"multiclass_strategy": "ovr"}',
'{"C":0.0275, "kernel": "liblinear", "multiclass_strategy": "ovr"}',
'{"C": 7, "gamma": 10.0, "kernel": "rbf", "multiclass_strategy": '
@@ -97,7 +97,7 @@ def main(args_test=None):
for item in results:
results_tmp = {"n_jobs": [-1], "n_estimators": [100]}
for key, value in results[item].items():
new_key = f"base_estimator__{key}"
new_key = f"estimator__{key}"
try:
results_tmp[new_key] = sorted(value)
except TypeError:
@@ -111,6 +111,7 @@ def main(args_test=None):
t2 = sorted([x for x in value if isinstance(x, str)])
results_tmp[new_key] = t1 + t2
output.append(results_tmp)
# save results
file_name = Files.grid_input(args.score, args.model)
file_output = os.path.join(Folders.results, file_name)

View File

@@ -18,7 +18,7 @@ class BestResultTest(TestBase):
"C": 7,
"gamma": 0.1,
"kernel": "rbf",
"max_iter": 10000.0,
"max_iter": 10000,
"multiclass_strategy": "ovr",
},
"results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json",

View File

@@ -52,7 +52,7 @@ class ExperimentTest(TestBase):
"C": 7,
"gamma": 0.1,
"kernel": "rbf",
"max_iter": 10000.0,
"max_iter": 10000,
"multiclass_strategy": "ovr",
},
"results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json",

View File

@@ -1 +1 @@
{"balance-scale": [0.98, {"splitter": "best", "max_features": "auto"}, "results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json"], "balloons": [0.86, {"C": 7, "gamma": 0.1, "kernel": "rbf", "max_iter": 10000.0, "multiclass_strategy": "ovr"}, "results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json"]}
{"balance-scale": [0.98, {"splitter": "best", "max_features": "auto"}, "results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json"], "balloons": [0.86, {"C": 7, "gamma": 0.1, "kernel": "rbf", "max_iter": 10000, "multiclass_strategy": "ovr"}, "results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json"]}

View File

@@ -17,10 +17,10 @@
"features": 4,
"classes": 3,
"hyperparameters": {
"C": 10000.0,
"C": 10000,
"gamma": 0.1,
"kernel": "rbf",
"max_iter": 10000.0,
"max_iter": 10000,
"multiclass_strategy": "ovr"
},
"nodes": 7.0,
@@ -40,7 +40,7 @@
"C": 7,
"gamma": 0.1,
"kernel": "rbf",
"max_iter": 10000.0,
"max_iter": 10000,
"multiclass_strategy": "ovr"
},
"nodes": 3.0,

View File

@@ -6,13 +6,13 @@
"n_estimators": [
100
],
"base_estimator__C": [
"estimator__C": [
1.0
],
"base_estimator__kernel": [
"estimator__kernel": [
"linear"
],
"base_estimator__multiclass_strategy": [
"estimator__multiclass_strategy": [
"ovo"
]
},
@@ -23,7 +23,7 @@
"n_estimators": [
100
],
"base_estimator__C": [
"estimator__C": [
0.001,
0.0275,
0.05,
@@ -36,10 +36,10 @@
7,
10000.0
],
"base_estimator__kernel": [
"estimator__kernel": [
"liblinear"
],
"base_estimator__multiclass_strategy": [
"estimator__multiclass_strategy": [
"ovr"
]
},
@@ -50,7 +50,7 @@
"n_estimators": [
100
],
"base_estimator__C": [
"estimator__C": [
0.05,
1.0,
1.05,
@@ -62,7 +62,7 @@
57,
10000.0
],
"base_estimator__gamma": [
"estimator__gamma": [
0.001,
0.1,
0.14,
@@ -70,10 +70,10 @@
"auto",
"scale"
],
"base_estimator__kernel": [
"estimator__kernel": [
"rbf"
],
"base_estimator__multiclass_strategy": [
"estimator__multiclass_strategy": [
"ovr"
]
},
@@ -84,20 +84,20 @@
"n_estimators": [
100
],
"base_estimator__C": [
"estimator__C": [
0.05,
0.2,
1.0,
8.25
],
"base_estimator__gamma": [
"estimator__gamma": [
0.1,
"scale"
],
"base_estimator__kernel": [
"estimator__kernel": [
"poly"
],
"base_estimator__multiclass_strategy": [
"estimator__multiclass_strategy": [
"ovo",
"ovr"
]

View File

@@ -9,7 +9,7 @@
Dataset Sampl. Feat. Cls Nodes Leaves Depth Score Time Hyperparameters
============================== ====== ===== === ======= ======= ======= =============== ================= ===============
balance-scale 625 4 3 23.32 12.16 6.44 0.840160±0.0304 0.013745±0.0019 {'splitter': 'best', 'max_features': 'auto'}
balloons 16 4 2 3.00 2.00 2.00 0.860000±0.2850 0.000388±0.0000 {'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}
balloons 16 4 2 3.00 2.00 2.00 0.860000±0.2850 0.000388±0.0000 {'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000, 'multiclass_strategy': 'ovr'}
*************************************************************************************************************************
* accuracy compared to STree_default (liblinear-ovr) .: 0.0422 *
*************************************************************************************************************************

View File

@@ -32,7 +32,7 @@
7;9;"0.0150468069702512"
7;10;"0.01404867172241211"
7;11;"0.002026269126958884"
7;12;"{'C': 10000.0, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}"
7;12;"{'C': 10000, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000, 'multiclass_strategy': 'ovr'}"
8;1;"balloons"
8;2;"16"
8;3;"4"
@@ -44,5 +44,5 @@
8;9;"0.2850146195080759"
8;10;"0.0008541679382324218"
8;11;"3.629469326417878e-05"
8;12;"{'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}"
8;12;"{'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000, 'multiclass_strategy': 'ovr'}"
10;1;"** accuracy compared to STree_default (liblinear-ovr) .: 0.0454"

View File

@@ -32,7 +32,7 @@
7;10;0.0150468069702512
7;11;0.01404867172241211
7;12;0.002026269126958884
7;13;"{'C': 10000.0, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}"
7;13;"{'C': 10000, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000, 'multiclass_strategy': 'ovr'}"
8;1;"balloons"
8;2;16
8;3;4
@@ -45,7 +45,7 @@
8;10;0.2850146195080759
8;11;0.0008541679382324218
8;12;3.629469326417878e-05
8;13;"{'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}"
8;13;"{'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000, 'multiclass_strategy': 'ovr'}"
11;2;"✔"
11;3;1
11;4;"Equal to best"

View File

@@ -32,7 +32,7 @@
7;9;"0.0150468069702512"
7;10;"0.01404867172241211"
7;11;"0.002026269126958884"
7;12;"{'C': 10000.0, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}"
7;12;"{'C': 10000, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000, 'multiclass_strategy': 'ovr'}"
8;1;"balloons"
8;2;"16"
8;3;"4"
@@ -44,5 +44,5 @@
8;9;"0.2850146195080759"
8;10;"0.0008541679382324218"
8;11;"3.629469326417878e-05"
8;12;"{'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}"
8;12;"{'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000, 'multiclass_strategy': 'ovr'}"
10;1;"** accuracy compared to STree_default (liblinear-ovr) .: 0.0454"

View File

@@ -8,8 +8,8 @@
Dataset Sampl. Feat. Cls Nodes Leaves Depth Score Time Hyperparameters
============================== ====== ===== === ======= ======= ======= =============== ================= ===============
balance-scale 625 4 3 7.00 4.00 3.00 0.970560±0.0150 0.014049±0.0020 {'C': 10000.0, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}
balloons 16 4 2 3.00 2.00 2.00 0.860000±0.2850 0.000854±0.0000 {'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}
balance-scale 625 4 3 7.00 4.00 3.00 0.970560±0.0150 0.014049±0.0020 {'C': 10000, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000, 'multiclass_strategy': 'ovr'}
balloons 16 4 2 3.00 2.00 2.00 0.860000±0.2850 0.000854±0.0000 {'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000, 'multiclass_strategy': 'ovr'}
*************************************************************************************************************************
* accuracy compared to STree_default (liblinear-ovr) .: 0.0454 *
*************************************************************************************************************************

View File

@@ -5,7 +5,7 @@
Dataset Score File/Message Hyperparameters
============================== ======== ============================================================================ =============================================
balance-scale 0.980000 results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json {'splitter': 'best', 'max_features': 'auto'}
balloons 0.860000 results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json {'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}
balloons 0.860000 results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json {'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000, 'multiclass_strategy': 'ovr'}
******************************************************************************************************************************************************************
* accuracy compared to STree_default (liblinear-ovr) .: 0.0457 *
******************************************************************************************************************************************************************

View File

@@ -8,8 +8,8 @@
Dataset Sampl. Feat. Cls Nodes Leaves Depth Score Time Hyperparameters
============================== ====== ===== === ======= ======= ======= =============== ================= ===============
balance-scale 625 4 3 7.00 4.00 3.00 0.970560±0.0150 0.014049±0.0020 {'C': 10000.0, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}
balloons 16 4 2 3.00 2.00 2.00 0.860000±0.2850✔ 0.000854±0.0000 {'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000.0, 'multiclass_strategy': 'ovr'}
balance-scale 625 4 3 7.00 4.00 3.00 0.970560±0.0150 0.014049±0.0020 {'C': 10000, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000, 'multiclass_strategy': 'ovr'}
balloons 16 4 2 3.00 2.00 2.00 0.860000±0.2850✔ 0.000854±0.0000 {'C': 7, 'gamma': 0.1, 'kernel': 'rbf', 'max_iter': 10000, 'multiclass_strategy': 'ovr'}
*************************************************************************************************************************
* ✔ Equal to best .....: 1 *
* accuracy compared to STree_default (liblinear-ovr) .: 0.0454 *