mirror of
https://github.com/Doctorado-ML/benchmark.git
synced 2025-08-18 00:45:54 +00:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
cf8fd3454e | ||
|
162cdc2da1 | ||
|
765112073c | ||
69e21584bd
|
|||
419c899c94
|
|||
2a2ed81a6c
|
|||
4c5502611a
|
|||
|
70f1da5fc7 |
@@ -1,12 +1,9 @@
|
|||||||
[](https://github.com/Doctorado-ML/benchmark/actions/workflows/main.yml)
|
|
||||||
[](https://codecov.io/gh/Doctorado-ML/benchmark)
|
[](https://codecov.io/gh/Doctorado-ML/benchmark)
|
||||||
[](https://sonar.rmontanana.es/dashboard?id=benchmark)
|
|
||||||
[](https://sonar.rmontanana.es/dashboard?id=benchmark)
|
|
||||||

|

|
||||||
|
|
||||||
# benchmark
|
# benchmark
|
||||||
|
|
||||||
Benchmarking models
|
Benchmarking Python models
|
||||||
|
|
||||||
## Experimentation
|
## Experimentation
|
||||||
|
|
||||||
|
@@ -32,6 +32,8 @@ class DatasetsArff:
|
|||||||
def get_range_features(X, c_features):
|
def get_range_features(X, c_features):
|
||||||
if c_features.strip() == "all":
|
if c_features.strip() == "all":
|
||||||
return list(range(X.shape[1]))
|
return list(range(X.shape[1]))
|
||||||
|
if c_features.strip() == "none":
|
||||||
|
return []
|
||||||
return json.loads(c_features)
|
return json.loads(c_features)
|
||||||
|
|
||||||
def load(self, name, class_name):
|
def load(self, name, class_name):
|
||||||
@@ -129,29 +131,28 @@ class Datasets:
|
|||||||
|
|
||||||
def _init_names(self, dataset_name):
|
def _init_names(self, dataset_name):
|
||||||
file_name = os.path.join(self.dataset.folder(), Files.index)
|
file_name = os.path.join(self.dataset.folder(), Files.index)
|
||||||
default_class = "class"
|
|
||||||
self.continuous_features = {}
|
self.continuous_features = {}
|
||||||
with open(file_name) as f:
|
with open(file_name) as f:
|
||||||
sets = f.read().splitlines()
|
sets = f.read().splitlines()
|
||||||
sets = [x for x in sets if not x.startswith("#")]
|
sets = [x for x in sets if not x.startswith("#")]
|
||||||
class_names = [default_class] * len(sets)
|
results = []
|
||||||
if "," in sets[0]:
|
class_names = []
|
||||||
result = []
|
for set_name in sets:
|
||||||
class_names = []
|
try:
|
||||||
for data in sets:
|
name, class_name, features = set_name.split(";")
|
||||||
name, class_name, features = data.split(",", 2)
|
except ValueError:
|
||||||
result.append(name)
|
class_name = "class"
|
||||||
class_names.append(class_name)
|
features = "all"
|
||||||
self.continuous_features[name] = features
|
name = set_name
|
||||||
sets = result
|
results.append(name)
|
||||||
else:
|
class_names.append(class_name)
|
||||||
for name in sets:
|
features = features.strip()
|
||||||
self.continuous_features[name] = None
|
self.continuous_features[name] = features
|
||||||
# Set as dataset list the dataset passed as argument
|
# Set as dataset list the dataset passed as argument
|
||||||
if dataset_name is None:
|
if dataset_name is None:
|
||||||
return class_names, sets
|
return class_names, results
|
||||||
try:
|
try:
|
||||||
class_name = class_names[sets.index(dataset_name)]
|
class_name = class_names[results.index(dataset_name)]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise ValueError(f"Unknown dataset: {dataset_name}")
|
raise ValueError(f"Unknown dataset: {dataset_name}")
|
||||||
return [class_name], [dataset_name]
|
return [class_name], [dataset_name]
|
||||||
|
@@ -108,9 +108,11 @@ class BaseReport(abc.ABC):
|
|||||||
status = (
|
status = (
|
||||||
Symbols.cross
|
Symbols.cross
|
||||||
if accuracy <= max_value
|
if accuracy <= max_value
|
||||||
else Symbols.upward_arrow
|
else (
|
||||||
if accuracy > max_value
|
Symbols.upward_arrow
|
||||||
else " "
|
if accuracy > max_value
|
||||||
|
else " "
|
||||||
|
)
|
||||||
)
|
)
|
||||||
if status != " ":
|
if status != " ":
|
||||||
if status not in self._compare_totals:
|
if status not in self._compare_totals:
|
||||||
@@ -161,6 +163,11 @@ class StubReport(BaseReport):
|
|||||||
def header(self) -> None:
|
def header(self) -> None:
|
||||||
self.title = self.data["title"]
|
self.title = self.data["title"]
|
||||||
self.duration = self.data["duration"]
|
self.duration = self.data["duration"]
|
||||||
|
self.model = self.data["model"]
|
||||||
|
self.date = self.data["date"]
|
||||||
|
self.time = self.data["time"]
|
||||||
|
self.metric = self.data["score_name"]
|
||||||
|
self.platform = self.data["platform"]
|
||||||
|
|
||||||
def footer(self, accuracy: float) -> None:
|
def footer(self, accuracy: float) -> None:
|
||||||
self.accuracy = accuracy
|
self.accuracy = accuracy
|
||||||
@@ -195,9 +202,11 @@ class Summary:
|
|||||||
self.models.add(model)
|
self.models.add(model)
|
||||||
report = StubReport(
|
report = StubReport(
|
||||||
os.path.join(
|
os.path.join(
|
||||||
Folders.hidden_results
|
(
|
||||||
if self.hidden
|
Folders.hidden_results
|
||||||
else Folders.results,
|
if self.hidden
|
||||||
|
else Folders.results
|
||||||
|
),
|
||||||
result,
|
result,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@@ -10,7 +10,7 @@ from .Results import Report
|
|||||||
from ._version import __version__
|
from ._version import __version__
|
||||||
|
|
||||||
__author__ = "Ricardo Montañana Gómez"
|
__author__ = "Ricardo Montañana Gómez"
|
||||||
__copyright__ = "Copyright 2020-2023, Ricardo Montañana Gómez"
|
__copyright__ = "Copyright 2020-2024, Ricardo Montañana Gómez"
|
||||||
__license__ = "MIT License"
|
__license__ = "MIT License"
|
||||||
__author_email__ = "ricardo.montanana@alu.uclm.es"
|
__author_email__ = "ricardo.montanana@alu.uclm.es"
|
||||||
|
|
||||||
|
@@ -1 +1 @@
|
|||||||
__version__ = "0.5.0"
|
__version__ = "1.0.1"
|
||||||
|
@@ -88,7 +88,7 @@
|
|||||||
<button type="button"
|
<button type="button"
|
||||||
class="btn-close"
|
class="btn-close"
|
||||||
aria-label="Close"
|
aria-label="Close"
|
||||||
onclick="location.href = '/index/{{ compare }}'"></button>
|
onclick="location.href = '{{ back }}'"></button>
|
||||||
<h7>
|
<h7>
|
||||||
<b>
|
<b>
|
||||||
Total score: {{ "%.6f" % (data.results | sum(attribute="score") ) }}
|
Total score: {{ "%.6f" % (data.results | sum(attribute="score") ) }}
|
||||||
|
@@ -90,7 +90,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
<h2 class="has-text-white has-background-primary">
|
<h2 class="has-text-white has-background-primary">
|
||||||
<b>
|
<b>
|
||||||
<button class="delete" onclick="location.href = '/index/{{ compare }}'"></button>
|
<button class="delete" onclick="location.href = '{{ back }}'"></button>
|
||||||
Total score: {{ "%.6f" % (data.results | sum(attribute="score") ) }}
|
Total score: {{ "%.6f" % (data.results | sum(attribute="score") ) }}
|
||||||
</b>
|
</b>
|
||||||
</h2>
|
</h2>
|
||||||
|
@@ -68,7 +68,7 @@ class ArgumentsTest(TestBase):
|
|||||||
test_args = ["-n", "3", "-k", "date"]
|
test_args = ["-n", "3", "-k", "date"]
|
||||||
with self.assertRaises(SystemExit):
|
with self.assertRaises(SystemExit):
|
||||||
arguments.parse(test_args)
|
arguments.parse(test_args)
|
||||||
self.assertRegexpMatches(
|
self.assertRegex(
|
||||||
stderr.getvalue(),
|
stderr.getvalue(),
|
||||||
r"error: the following arguments are required: -m/--model",
|
r"error: the following arguments are required: -m/--model",
|
||||||
)
|
)
|
||||||
@@ -79,7 +79,7 @@ class ArgumentsTest(TestBase):
|
|||||||
test_args = ["-n", "3", "-m", "SVC"]
|
test_args = ["-n", "3", "-m", "SVC"]
|
||||||
with self.assertRaises(SystemExit):
|
with self.assertRaises(SystemExit):
|
||||||
arguments.parse(test_args)
|
arguments.parse(test_args)
|
||||||
self.assertRegexpMatches(
|
self.assertRegex(
|
||||||
stderr.getvalue(),
|
stderr.getvalue(),
|
||||||
r"error: the following arguments are required: -k/--key",
|
r"error: the following arguments are required: -k/--key",
|
||||||
)
|
)
|
||||||
@@ -114,7 +114,7 @@ class ArgumentsTest(TestBase):
|
|||||||
test_args = None
|
test_args = None
|
||||||
with self.assertRaises(SystemExit):
|
with self.assertRaises(SystemExit):
|
||||||
arguments.parse(test_args)
|
arguments.parse(test_args)
|
||||||
self.assertRegexpMatches(
|
self.assertRegex(
|
||||||
stderr.getvalue(),
|
stderr.getvalue(),
|
||||||
r"error: the following arguments are required: -m/--model, "
|
r"error: the following arguments are required: -m/--model, "
|
||||||
"-k/--key, --title",
|
"-k/--key, --title",
|
||||||
|
@@ -102,7 +102,7 @@ class ModelTest(TestBase):
|
|||||||
test = {
|
test = {
|
||||||
"STree": ((11, 6, 4), 1.0),
|
"STree": ((11, 6, 4), 1.0),
|
||||||
"Wodt": ((303, 152, 50), 0.9382022471910112),
|
"Wodt": ((303, 152, 50), 0.9382022471910112),
|
||||||
"ODTE": ((7.86, 4.43, 3.37), 1.0),
|
"ODTE": ((786, 443, 337), 1.0),
|
||||||
"Cart": ((23, 12, 5), 1.0),
|
"Cart": ((23, 12, 5), 1.0),
|
||||||
"SVC": ((0, 0, 0), 0.7078651685393258),
|
"SVC": ((0, 0, 0), 0.7078651685393258),
|
||||||
"RandomForest": ((21.3, 11, 5.26), 1.0),
|
"RandomForest": ((21.3, 11, 5.26), 1.0),
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
iris,class,all
|
iris;class;all
|
||||||
wine,class,[0, 1]
|
wine;class;[0, 1]
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
"kernel": "liblinear",
|
"kernel": "liblinear",
|
||||||
"multiclass_strategy": "ovr"
|
"multiclass_strategy": "ovr"
|
||||||
},
|
},
|
||||||
"v. 1.3.1, Computed on Test on 2022-02-22 at 12:00:00 took 1s"
|
"v. 1.4.0, Computed on Test on 2022-02-22 at 12:00:00 took 1s"
|
||||||
],
|
],
|
||||||
"balloons": [
|
"balloons": [
|
||||||
0.625,
|
0.625,
|
||||||
@@ -15,6 +15,6 @@
|
|||||||
"kernel": "linear",
|
"kernel": "linear",
|
||||||
"multiclass_strategy": "ovr"
|
"multiclass_strategy": "ovr"
|
||||||
},
|
},
|
||||||
"v. 1.3.1, Computed on Test on 2022-02-22 at 12:00:00 took 1s"
|
"v. 1.4.0, Computed on Test on 2022-02-22 at 12:00:00 took 1s"
|
||||||
]
|
]
|
||||||
}
|
}
|
@@ -120,7 +120,7 @@ class BeMainTest(TestBase):
|
|||||||
module.main(parameter)
|
module.main(parameter)
|
||||||
self.assertEqual(msg.exception.code, 2)
|
self.assertEqual(msg.exception.code, 2)
|
||||||
self.assertEqual(stderr.getvalue(), "")
|
self.assertEqual(stderr.getvalue(), "")
|
||||||
self.assertRegexpMatches(stdout.getvalue(), message)
|
self.assertRegex(stdout.getvalue(), message)
|
||||||
|
|
||||||
def test_be_main_best_params_non_existent(self):
|
def test_be_main_best_params_non_existent(self):
|
||||||
model = "GBC"
|
model = "GBC"
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
1;1;"Datasets used in benchmark ver. 0.5.0"
|
1;1;"Datasets used in benchmark ver. 1.0.1"
|
||||||
2;1;" Default score accuracy"
|
2;1;" Default score accuracy"
|
||||||
2;2;"Cross validation"
|
2;2;"Cross validation"
|
||||||
2;6;"5 Folds"
|
2;6;"5 Folds"
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
[94mDatasets used in benchmark ver. 0.5.0
|
[94mDatasets used in benchmark ver. 1.0.1
|
||||||
|
|
||||||
Dataset Sampl. Feat. Cont Cls Balance
|
Dataset Sampl. Feat. Cont Cls Balance
|
||||||
============================== ====== ===== ==== === ==========================================
|
============================== ====== ===== ==== === ==========================================
|
||||||
|
Reference in New Issue
Block a user