|
CellModules
|
Public Member Functions | |
| def | __init__ (self, study=None) |
| def | set_study (self, study) |
| def | register (self) |
| def | context_add (self, str name, Any value) |
| def | context_add_many (self, dict[str, Any] mapping) |
| def | set_suggest_entrypoint (self, str name) |
| def | set_run_entrypoint (self, str name) |
| def | set_eval_entrypoint (self, str name) |
| def | study_add_data (self, str key, Any value) |
| def | study_add_axis (self, str name, Any values) |
| def | trial_add_timeseries (self, trial, str key, Any values, list[str] axes, Optional[list[str]] columns=None, str value_col="value", str layout="aligned") |
| def | check_minimal (self, bool require_run_function=True) |
Static Public Member Functions | |
| def | trial_add_data (trial, str key, Any value) |
Public Attributes | |
| study | |
Static Public Attributes | |
| string | KEY_ENTRY_SUGGEST = "entrypoint:suggest" |
| string | KEY_ENTRY_RUN = "entrypoint:run" |
| string | KEY_ENTRY_EVAL = "entrypoint:eval" |
| string | KEY_CONTEXT = "backupContext" |
| string | CONTEXT_ID = "__default__" |
Private Member Functions | |
| def | _require_custom_db (self) |
| def | _require_study (self) |
| def | _ensure_isicell_tables (self) |
| def | _flush_context_if_possible (self) |
| def | _flush_entrypoints_if_possible (self) |
| dict[str, Any] | _encode_context_value (self, Any value) |
| str | _extract_sqlite_path_from_study (self, study) |
| def | _set_entrypoint (self, str key, str name) |
Static Private Member Functions | |
| Any | _to_jsonable (Any x) |
Private Attributes | |
| _db_path | |
| _con_custom | |
Lightweight helper to standardize what is stored in Optuna study/trial user_attrs. Main idea: - Typed helpers for trial outputs (timeseries) - Explicit function registration (suggest/run/eval) - Optional context capture via `with archiver.register(): ...` to archive helper functions + runtime objects automatically into study_user_attributes['backupContext'].
Definition at line 135 of file OptunaWrapper.py.
| def pythonlib.OptunaWrapper.OptunaArchive.__init__ | ( | self, | |
study = None |
|||
| ) |
Definition at line 155 of file OptunaWrapper.py.
|
private |
Context encoding policy: - functions/classes/callables -> source code (mode='source') if possible - JSON-serializable (after _to_jsonable) -> mode='json' - fallback -> pickle64b
Definition at line 306 of file OptunaWrapper.py.
|
private |
Definition at line 201 of file OptunaWrapper.py.
|
private |
Extract sqlite file path from an Optuna study backed by RDBStorage(sqlite), even if wrapped by _CachedStorage.
Definition at line 376 of file OptunaWrapper.py.
|
private |
Flush in-memory backupContext to custom table. Upsert behavior (safe if called multiple times).
Definition at line 226 of file OptunaWrapper.py.
|
private |
Flush cached entrypoints to custom table.
Definition at line 258 of file OptunaWrapper.py.
|
private |
Definition at line 189 of file OptunaWrapper.py.
|
private |
Definition at line 196 of file OptunaWrapper.py.
|
private |
API inchangée: - vérifie que le symbole existe dans backupContext et est source-backed - stocke en cache + flush si possible
Definition at line 418 of file OptunaWrapper.py.
|
staticprivate |
Definition at line 282 of file OptunaWrapper.py.
| def pythonlib.OptunaWrapper.OptunaArchive.check_minimal | ( | self, | |
| bool | require_run_function = True |
||
| ) |
Definition at line 531 of file OptunaWrapper.py.
| def pythonlib.OptunaWrapper.OptunaArchive.context_add | ( | self, | |
| str | name, | ||
| Any | value | ||
| ) |
Definition at line 368 of file OptunaWrapper.py.
| def pythonlib.OptunaWrapper.OptunaArchive.context_add_many | ( | self, | |
| dict[str, Any] | mapping | ||
| ) |
Definition at line 372 of file OptunaWrapper.py.
| def pythonlib.OptunaWrapper.OptunaArchive.register | ( | self | ) |
Capture newly created symbols in caller scope and store them in backupContext.
Example
-------
archiver = OptunaArchive(study)
with archiver.register():
data = {...}
def dataCatcherOnStep(...): ...
def run_simu(...): ...
def optim(trial): ...
# all new symbols now archived in study_user_attributes['backupContext']
Definition at line 328 of file OptunaWrapper.py.
| def pythonlib.OptunaWrapper.OptunaArchive.set_eval_entrypoint | ( | self, | |
| str | name | ||
| ) |
Definition at line 456 of file OptunaWrapper.py.
| def pythonlib.OptunaWrapper.OptunaArchive.set_run_entrypoint | ( | self, | |
| str | name | ||
| ) |
Definition at line 453 of file OptunaWrapper.py.
| def pythonlib.OptunaWrapper.OptunaArchive.set_study | ( | self, | |
| study | |||
| ) |
Definition at line 172 of file OptunaWrapper.py.
| def pythonlib.OptunaWrapper.OptunaArchive.set_suggest_entrypoint | ( | self, | |
| str | name | ||
| ) |
Definition at line 450 of file OptunaWrapper.py.
| def pythonlib.OptunaWrapper.OptunaArchive.study_add_axis | ( | self, | |
| str | name, | ||
| Any | values | ||
| ) |
Definition at line 473 of file OptunaWrapper.py.
| def pythonlib.OptunaWrapper.OptunaArchive.study_add_data | ( | self, | |
| str | key, | ||
| Any | value | ||
| ) |
Definition at line 462 of file OptunaWrapper.py.
|
static |
Definition at line 467 of file OptunaWrapper.py.
| def pythonlib.OptunaWrapper.OptunaArchive.trial_add_timeseries | ( | self, | |
| trial, | |||
| str | key, | ||
| Any | values, | ||
| list[str] | axes, | ||
| Optional[list[str]] | columns = None, |
||
| str | value_col = "value", |
||
| str | layout = "aligned" |
||
| ) |
Store trial-level flattened values and a study-level spec. layout='product' : cartesian product of axes layout='aligned' : zipped/aligned axes (same length as values)
Definition at line 480 of file OptunaWrapper.py.
|
private |
Definition at line 182 of file OptunaWrapper.py.
|
private |
Definition at line 174 of file OptunaWrapper.py.
|
static |
Definition at line 153 of file OptunaWrapper.py.
|
static |
Definition at line 150 of file OptunaWrapper.py.
|
static |
Definition at line 149 of file OptunaWrapper.py.
|
static |
Definition at line 148 of file OptunaWrapper.py.
|
static |
Definition at line 147 of file OptunaWrapper.py.
| pythonlib.OptunaWrapper.OptunaArchive.study |
Definition at line 156 of file OptunaWrapper.py.