Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save results immediately #422

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions moabb/evaluations/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ def process(self, pipelines, param_grid=None):

for dataset in self.datasets:
log.info("Processing dataset: {}".format(dataset.code))
results = self.evaluate(dataset, pipelines, param_grid)
for res in results:
self.push_result(res, pipelines)
_ = self.evaluate(dataset, pipelines, param_grid)

return self.results.to_dataframe(pipelines=pipelines)

Expand Down
7 changes: 5 additions & 2 deletions moabb/evaluations/evaluations.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
except ImportError:
_carbonfootprint = False


log = logging.getLogger(__name__)

# Numpy ArrayLike is only available starting from Numpy 1.20 and Python 3.8
Expand Down Expand Up @@ -305,6 +304,7 @@ def _evaluate_subject(self, dataset, pipelines, param_grid, subject):
if _carbonfootprint:
res["carbon_emission"] = (1000 * emissions,)
subject_results.append(res)
self.push_result(res, pipelines)

return subject_results

Expand Down Expand Up @@ -398,7 +398,7 @@ def _evaluate_learning_curve(self, dataset, pipelines):
continue
not_enough_data = False
log.info(
f"Permutation: {perm_i+1},"
f"Permutation: {perm_i + 1},"
f" Training samples: {len(subset_indices)}"
)

Expand Down Expand Up @@ -661,6 +661,8 @@ def process_subject(self, subject, param_grid, pipelines, dataset):
res["carbon_emission"] = (1000 * (emissions + emissions_grid),)

results.append(res)
self.push_result(res, pipelines)

return results

def is_valid(self, dataset):
Expand Down Expand Up @@ -859,6 +861,7 @@ def evaluate(self, dataset, pipelines, param_grid):
res["carbon_emission"] = (
1000 * (emissions + emissions_grid[name]),
)
self.push_result(res, pipelines)
yield res

def is_valid(self, dataset):
Expand Down
Loading