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

|
||||
|
||||
# benchmark
|
||||
|
@@ -32,6 +32,8 @@ class DatasetsArff:
|
||||
def get_range_features(X, c_features):
|
||||
if c_features.strip() == "all":
|
||||
return list(range(X.shape[1]))
|
||||
if c_features.strip() == "none":
|
||||
return []
|
||||
return json.loads(c_features)
|
||||
|
||||
def load(self, name, class_name):
|
||||
@@ -129,29 +131,28 @@ class Datasets:
|
||||
|
||||
def _init_names(self, dataset_name):
|
||||
file_name = os.path.join(self.dataset.folder(), Files.index)
|
||||
default_class = "class"
|
||||
self.continuous_features = {}
|
||||
with open(file_name) as f:
|
||||
sets = f.read().splitlines()
|
||||
sets = [x for x in sets if not x.startswith("#")]
|
||||
class_names = [default_class] * len(sets)
|
||||
if "," in sets[0]:
|
||||
result = []
|
||||
class_names = []
|
||||
for data in sets:
|
||||
name, class_name, features = data.split(",", 2)
|
||||
result.append(name)
|
||||
class_names.append(class_name)
|
||||
self.continuous_features[name] = features
|
||||
sets = result
|
||||
else:
|
||||
for name in sets:
|
||||
self.continuous_features[name] = None
|
||||
results = []
|
||||
class_names = []
|
||||
for set_name in sets:
|
||||
try:
|
||||
name, class_name, features = set_name.split(";")
|
||||
except ValueError:
|
||||
class_name = "class"
|
||||
features = "all"
|
||||
name = set_name
|
||||
results.append(name)
|
||||
class_names.append(class_name)
|
||||
features = features.strip()
|
||||
self.continuous_features[name] = features
|
||||
# Set as dataset list the dataset passed as argument
|
||||
if dataset_name is None:
|
||||
return class_names, sets
|
||||
return class_names, results
|
||||
try:
|
||||
class_name = class_names[sets.index(dataset_name)]
|
||||
class_name = class_names[results.index(dataset_name)]
|
||||
except ValueError:
|
||||
raise ValueError(f"Unknown dataset: {dataset_name}")
|
||||
return [class_name], [dataset_name]
|
||||
|
@@ -108,9 +108,11 @@ class BaseReport(abc.ABC):
|
||||
status = (
|
||||
Symbols.cross
|
||||
if accuracy <= max_value
|
||||
else Symbols.upward_arrow
|
||||
if accuracy > max_value
|
||||
else " "
|
||||
else (
|
||||
Symbols.upward_arrow
|
||||
if accuracy > max_value
|
||||
else " "
|
||||
)
|
||||
)
|
||||
if status != " ":
|
||||
if status not in self._compare_totals:
|
||||
@@ -161,6 +163,11 @@ class StubReport(BaseReport):
|
||||
def header(self) -> None:
|
||||
self.title = self.data["title"]
|
||||
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:
|
||||
self.accuracy = accuracy
|
||||
@@ -195,9 +202,11 @@ class Summary:
|
||||
self.models.add(model)
|
||||
report = StubReport(
|
||||
os.path.join(
|
||||
Folders.hidden_results
|
||||
if self.hidden
|
||||
else Folders.results,
|
||||
(
|
||||
Folders.hidden_results
|
||||
if self.hidden
|
||||
else Folders.results
|
||||
),
|
||||
result,
|
||||
)
|
||||
)
|
||||
|
@@ -10,7 +10,7 @@ from .Results import Report
|
||||
from ._version import __version__
|
||||
|
||||
__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"
|
||||
__author_email__ = "ricardo.montanana@alu.uclm.es"
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
__version__ = "0.5.0"
|
||||
__version__ = "1.0.1"
|
||||
|
@@ -88,7 +88,7 @@
|
||||
<button type="button"
|
||||
class="btn-close"
|
||||
aria-label="Close"
|
||||
onclick="location.href = '/index/{{ compare }}'"></button>
|
||||
onclick="location.href = '{{ back }}'"></button>
|
||||
<h7>
|
||||
<b>
|
||||
Total score: {{ "%.6f" % (data.results | sum(attribute="score") ) }}
|
||||
|
@@ -90,7 +90,7 @@
|
||||
{% endif %}
|
||||
<h2 class="has-text-white has-background-primary">
|
||||
<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") ) }}
|
||||
</b>
|
||||
</h2>
|
||||
|
@@ -68,7 +68,7 @@ class ArgumentsTest(TestBase):
|
||||
test_args = ["-n", "3", "-k", "date"]
|
||||
with self.assertRaises(SystemExit):
|
||||
arguments.parse(test_args)
|
||||
self.assertRegexpMatches(
|
||||
self.assertRegex(
|
||||
stderr.getvalue(),
|
||||
r"error: the following arguments are required: -m/--model",
|
||||
)
|
||||
@@ -79,7 +79,7 @@ class ArgumentsTest(TestBase):
|
||||
test_args = ["-n", "3", "-m", "SVC"]
|
||||
with self.assertRaises(SystemExit):
|
||||
arguments.parse(test_args)
|
||||
self.assertRegexpMatches(
|
||||
self.assertRegex(
|
||||
stderr.getvalue(),
|
||||
r"error: the following arguments are required: -k/--key",
|
||||
)
|
||||
@@ -114,7 +114,7 @@ class ArgumentsTest(TestBase):
|
||||
test_args = None
|
||||
with self.assertRaises(SystemExit):
|
||||
arguments.parse(test_args)
|
||||
self.assertRegexpMatches(
|
||||
self.assertRegex(
|
||||
stderr.getvalue(),
|
||||
r"error: the following arguments are required: -m/--model, "
|
||||
"-k/--key, --title",
|
||||
|
@@ -102,7 +102,7 @@ class ModelTest(TestBase):
|
||||
test = {
|
||||
"STree": ((11, 6, 4), 1.0),
|
||||
"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),
|
||||
"SVC": ((0, 0, 0), 0.7078651685393258),
|
||||
"RandomForest": ((21.3, 11, 5.26), 1.0),
|
||||
|
@@ -1,2 +1,2 @@
|
||||
iris,class,all
|
||||
wine,class,[0, 1]
|
||||
iris;class;all
|
||||
wine;class;[0, 1]
|
||||
|
@@ -6,7 +6,7 @@
|
||||
"kernel": "liblinear",
|
||||
"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": [
|
||||
0.625,
|
||||
@@ -15,6 +15,6 @@
|
||||
"kernel": "linear",
|
||||
"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)
|
||||
self.assertEqual(msg.exception.code, 2)
|
||||
self.assertEqual(stderr.getvalue(), "")
|
||||
self.assertRegexpMatches(stdout.getvalue(), message)
|
||||
self.assertRegex(stdout.getvalue(), message)
|
||||
|
||||
def test_be_main_best_params_non_existent(self):
|
||||
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;2;"Cross validation"
|
||||
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
|
||||
============================== ====== ===== ==== === ==========================================
|
||||
|
Reference in New Issue
Block a user