-
Notifications
You must be signed in to change notification settings - Fork 63
feat (search): adding option to disable dumping the results to civ #325
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #325 +/- ##
===========================================
+ Coverage 43.69% 49.92% +6.23%
===========================================
Files 124 108 -16
Lines 8377 7609 -768
Branches 1375 1219 -156
===========================================
+ Hits 3660 3799 +139
+ Misses 4387 3468 -919
- Partials 330 342 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| if len(resultsList) > 0: | ||
| started_dumping = self._csv_cursor > 0 | ||
| file_mode = "a" if started_dumping else "w" | ||
|
|
||
| if not (started_dumping): | ||
| for result in resultsList: | ||
| # Waiting to start receiving non-failed jobs before dumping results | ||
| is_single_obj_and_has_success = ( | ||
| "objective" in result and type(result["objective"]) is not str | ||
| ) | ||
| is_multi_obj_and_has_success = ( | ||
| "objective_0" in result and type(result["objective_0"]) is not str | ||
| ) | ||
| if is_single_obj_and_has_success or is_multi_obj_and_has_success or flush: | ||
| self._csv_columns = result.keys() | ||
| break | ||
|
|
||
| if self._csv_columns is not None: | ||
| with open(os.path.join(path), file_mode) as fp: | ||
| writer = csv.DictWriter(fp, self._csv_columns, extrasaction="ignore") | ||
| if not (started_dumping): | ||
| writer.writeheader() | ||
| writer.writerows(resultsList) | ||
| self._csv_cursor += len(resultsList) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be avoided by converting the results list to a dataframe then use pandas to write the dataframe to csv file? This would eliminate importing the csv module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is to avoid redundant writing. It just appends new lines. The pandas logic would re-write everything again an again. Making the complexity squared instead of linear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The self.jobs = [] is a list of dictionaries, is that right? Each dictionary represents the results of a completed job, is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The self.jobs is actually a list of HPOJob objects.
|
At the end of the self.dump_jobs_done_to_csv(flush=True)
self.history.compute_pareto_efficiency()
df_results = self.history.to_dataframe()
return df_resultsIt looks like the job results are written to CSV then the pareto results are calculated. Does this update the CSV with the pareto results? |
…gather callback for callback interface, cleaning up evaluator code, adapting code in search
|
The PR is looking better but we still need to add a few unit tests. |
|
The |
|
I merged the latest develop branch into this branch and apparently it fixed the failing Redis tests. |
|
For the |
|
The search method is currently defined as: search(self, max_evals: int = -1, timeout: int = None, max_evals_strict: bool = False)A better definition would be the following: search(self, max_evals=-1, timeout=0, max_evals_strict=False) -> pd.DataFrameWhen you have default values there is no need to explicitly give the type, it is inferred from the default value. I don't know why |
|
Hi @wigging ,
|
Allow the user to disable writing search results to a CSV file. Collect search results using a SearchHistory class. Resolves issue #309 .