mira.topics.Redis#
- class mira.topics.Redis(url='redis://localhost:6379', heartbeat_interval=30, grace_period=None, failed_trial_callback=None)#
Connects the optuna hyperparameter optimization instance to a REDIS server backend.
- Parameters
- urlstr, default = “redis://localhost:6379”
The URL which connects to the REDIS database. The standard format is:
redis://<serverlocation>:<port>
If the REDIS server is running on the same machine as MIRA, then its address will be “localhost”. The provided port is the default used by REDIS.
- heartbeat_intervalint > 0, default = 30
How often to check that database server is still running during tuning, in seconds.
- grace_periodint > 0 or None, default = None
If connection to database is lost, how long to wait for the connection to be restored before terminating tuning.
- failed_trial_callbackfunction or None, default = None
Run this function if commiting to the database fails.
Examples
..code-block :: python
>>> tuner = mira.topics.SpeedyTuner( ... model = model, ... min_topics = 5, ... max_topics = 55, ... n_jobs = 1, ... save_name = 'tuning/rna/0', ... storage = mira.topics.Redis(), ... )
Methods
check_trial_is_updatable(trial_id, trial_state)Check whether a trial state is updatable.
create_new_study([study_name])Create a new study from a name.
create_new_trial(study_id[, template_trial])Create and add a new trial to a study.
delete_study(study_id)Delete a study.
fail_stale_trials(study_id)Fail stale trials.
get_all_study_summaries()Read a list of
StudySummaryobjects.get_all_trials(study_id[, deepcopy, states])Read all trials in a study.
get_best_trial(study_id)Return the trial with the best value in a study.
get_failed_trial_callback()Get the failed trial callback function.
get_heartbeat_interval()Get the heartbeat interval if it is set.
get_n_trials(study_id[, state])Count the number of trials in a study.
get_study_directions(study_id)Read whether a study maximizes or minimizes an objective.
get_study_id_from_name(study_name)Read the ID of a study.
get_study_id_from_trial_id(trial_id)Read the ID of a study to which a trial belongs.
get_study_name_from_id(study_id)Read the study name of a study.
get_study_system_attrs(study_id)Read the optuna-internal attributes of a study.
get_study_user_attrs(study_id)Read the user-defined attributes of a study.
get_trial(trial_id)Read a trial.
get_trial_id_from_study_id_trial_number(...)Read the trial ID of a trial.
get_trial_number_from_id(trial_id)Read the trial number of a trial.
get_trial_param(trial_id, param_name)Read the parameter of a trial.
get_trial_params(trial_id)Read the parameter dictionary of a trial.
get_trial_system_attrs(trial_id)Read the optuna-internal attributes of a trial.
get_trial_user_attrs(trial_id)Read the user-defined attributes of a trial.
is_heartbeat_enabled()Check whether the storage enables the heartbeat.
read_trials_from_remote_storage(study_id)Make an internal cache of trials up-to-date.
record_heartbeat(trial_id)Record the heartbeat of the trial.
remove_session()Clean up all connections to a database.
set_study_directions(study_id, directions)Register optimization problem directions to a study.
set_study_system_attr(study_id, key, value)Register an optuna-internal attribute to a study.
set_study_user_attr(study_id, key, value)Register a user-defined attribute to a study.
set_trial_intermediate_value(trial_id, step, ...)Report an intermediate value of an objective function.
set_trial_param(trial_id, param_name, ...)Set a parameter to a trial.
set_trial_state(trial_id, state)Update the state of a trial.
set_trial_system_attr(trial_id, key, value)Set an optuna-internal attribute to a trial.
set_trial_user_attr(trial_id, key, value)Set a user-defined attribute to a trial.
set_trial_values(trial_id, values)Set return values of an objective function.