Skip to main content

NeptuneOptunaAnalyzer

NeptuneOptunaAnalyzer(
    project: str,
    api_token: str = None,
)
Neptune runs and fetching experiment data analyzer. Method generated by attrs for class NeptuneOptunaAnalyzer.

Ancestors

  • systematica.tuners.base.BaseOptunaAnalyzer
  • systematica.tuners.base.BaseAnalyzer
  • abc.ABC

Methods

run_context

run_context(
    self,
    **kwargs,
) ‑> neptune.metadata_containers.run.Run
Context manager to initialize and stop a Neptune run. Parameters:
NameTypeDefaultDescription
kwargstp.Kwargs--Additional arguments to pass to neptune.init_run (e.g., with_id, mode).
Yields:
TypeDescription
neptune.RunThe initialized Neptune run object.

fetch_trials

fetch_trials(
    self,
    metadata_tag: str,
    run_ids: Tuple[str],
    is_trials: bool,
    is_file: bool = False,
    mode: str = 'read-only',
) ‑> pandas.core.frame.DataFrame
Fetch metadata from Neptune runs and return as a DataFrame. Parameters:
NameTypeDefaultDescription
metadata_tagstr--The metadata field to fetch (e.g., ‘best/values’, ‘trials/trials’).
run_idstp.Tuple[str]--The ID(s) of the Neptune run(s) to fetch.
is_trialsbool--Whether the metadata represents trials (True) or other data (False).
is_fileboolTrueFlag to fetch compressed file trials if True. Use namespace fetch() otherwise. Defaults to True.
modestrread-onlyConnection mode for Neptune. Options: ‘async’, ‘sync’, ‘offline’, ‘read-only’, ‘debug’. Defaults to ‘read-only’.
Returns:
TypeDescription
pd.DataFrameDataFrame containing the fetched metadata.

fetch_feature_config

fetch_feature_config(
    self,
    run,
    run_id: str,
) ‑> Dict[str, Any]
Fetch feature config from Neptune. Parameters:
NameTypeDefaultDescription
runneptune.Run--Neptune run.
run_idstr--The ID of the Neptune run to fetch.
Raises:
TypeDescription
SystematicaErrorNo metadata found for run_id.
Returns:
TypeDescription
tp.Kwargsmetadata params.

get_all_trials

get_all_trials(
    self,
    run_ids: str | List[str],
    is_file: bool = True,
) ‑> pandas.core.frame.DataFrame
Fetch all trials from Neptune runs. Parameters:
NameTypeDefaultDescription
run_idsstr--The ID(s) of the Neptune run(s) to fetch.
is_fileboolTrueFlag to fetch compressed file trials through ‘trials/compressed_trials’ if True. Fetch ‘trials/trials’ otherwise. Defaults to True.
Returns:
TypeDescription
pd.DataFrameAll trial data, including ‘run_id’ and ‘number’.

fetch_optuna_study

fetch_optuna_study(
    self,
    run_id: str,
) ‑> optuna.study.study.Study
Loads Optuna study from an existing Neptune run. Loading mechanics depend on the study storage type used during the run:
  • If the study used InMemoryStorage, it will be loaded from the logged pickled study object.
  • If the study used database storage, it will be loaded from the logged database URL.
To resume an existing run, you need the run ID. It is stored in the run’s sys/id field. Parameters:
NameTypeDefaultDescription
run_idstr--The ID of the Neptune run to fetch.
Returns:
TypeDescription
optuna.StudyThe Optuna study object.