optunaz.utils package

Subpackages

Submodules

optunaz.utils.files_paths module

optunaz.utils.files_paths.move_up_directory(path, n=1)[source]

Function, to move up “n” directories for a given “path”.

optunaz.utils.files_paths.attach_root_path(path)[source]

Function to attach the root path of the module for a given “path”.

optunaz.utils.load_json module

optunaz.utils.load_json.loadJSON(path)[source]

optunaz.utils.mlflow module

optunaz.utils.mlflow.add_ellipsis(name, max_length=100)[source]
optunaz.utils.mlflow.shorten_names(params)[source]
class optunaz.utils.mlflow.MLflowCallback(trial_number_offset, tracking_uri=None, optconfig=None)[source]

Bases: object

Callback to track Optuna trials with MLflow.

This callback adds Optuna-tracked information to MLflow. The MLflow experiment will be named after the Optuna study name. MLflow runs will be named after Optuna trial numbers.

trial_number_offset
tracking_uri = None

The URI of the MLflow tracking server. Please refer to mlflow.set_tracking_uri for more details.

optconfig = None
prepare_tags(study, trial)[source]

Sets the tags for MLflow.

tmp_buildconfig(study, trial)[source]

Creates a temporary file with build configuration, and returns a path to it.

optunaz.utils.retraining module

exception optunaz.utils.retraining.NoRetrainingDataConvention(task, message='input-directory file [{0}] does not contain a date format %Y-%m-%d')[source]

Bases: Exception

Raised if a file in input-directory does not follow the %Y-%m-%d convention

exception optunaz.utils.retraining.NoNewRetrainingData[source]

Bases: Exception

Raised if no new retraining data is available

exception optunaz.utils.retraining.NoDifferingRetrainingData[source]

Bases: Exception

Raised if no different retraining data is available between previous & current time bins

exception optunaz.utils.retraining.RetrainingHeadersIssue[source]

Bases: Exception

Raised when issue with retraining headers in a file (columns unknown)

exception optunaz.utils.retraining.RetrainingIsAlreadyProcessed(task, message='Retraining[{0}] already processed')[source]

Bases: Exception

Raised when retraining is processed

exception optunaz.utils.retraining.RetrainingIsLocked(task, message='Retraining[{0}] is locked')[source]

Bases: Exception

Raised when retraining is locked

exception optunaz.utils.retraining.TemporalPredsPredicted(task, message='Retraining[{0}] code is predicted')[source]

Bases: Exception

Raised when a temporal prediction is already predicted.

exception optunaz.utils.retraining.NoPreviousModel(prev_model_name, message='No previous model found for [{0}]')[source]

Bases: Exception

Raised when no previous model exists for a retraining point

exception optunaz.utils.retraining.SamePreviousModel(task, message='Retraining[{0}] already processed')[source]

Bases: Exception

Raised when a temporal prediction would be for the same (identical) model training

exception optunaz.utils.retraining.TimepointSkipped(task, message='Retraining[{0}] set to be skipped')[source]

Bases: Exception

Raised when a timepoint should be skipped

exception optunaz.utils.retraining.SlurmNoLog[source]

Bases: Exception

Raised when a SLURM job file is not present for submitted itcode jobs

exception optunaz.utils.retraining.SlurmTimeLimitExceeded[source]

Bases: Exception

Raised when a past SLURM job time was exceeded

exception optunaz.utils.retraining.SlurmMemoryExceeded[source]

Bases: Exception

Raised when a past SLURM memory was exceeded

exception optunaz.utils.retraining.SlurmJobSkip[source]

Bases: Exception

Raised when an itcode is no longer trialed with QSARtuna (i.e. due to incompatibility)

exception optunaz.utils.retraining.SlurmParseError[source]

Bases: Exception

Raised when a .sh SLURM job modification (for resubmission) is not possible

optunaz.utils.schema module

optunaz.utils.schema.create_dependency(key, value)[source]
optunaz.utils.schema.remove_schema_properties(schema, properties)[source]
optunaz.utils.schema.add_boolean_guards_for_schema_properties(schema, properties)[source]
optunaz.utils.schema.replacekey(input_)[source]
optunaz.utils.schema.replacevalue(input_)[source]
optunaz.utils.schema.addsibling(input_)[source]
optunaz.utils.schema.delsibling(input_, siblings)[source]
optunaz.utils.schema.getref(path, context)[source]

Recursively returns nested items from a dict.

optunaz.utils.schema.copytitle(input_, context)[source]

Copies “title” from “$ref” into oneOf.

optunaz.utils.schema.replaceenum(input_)[source]

Replace singleton enums with const.

optunaz.utils.schema.addtitles(schema)[source]

optunaz.utils.tracking module

optunaz.utils.tracking.get_authorization_header()[source]
class optunaz.utils.tracking.TrackingData(trial_number, trial_value, scoring, trial_state, all_cv_test_scores, buildconfig, algorith_hash)[source]

Bases: object

Dataclass defining internal tracking format

trial_number
trial_value
scoring
trial_state
all_cv_test_scores
buildconfig
algorith_hash
optunaz.utils.tracking.removeprefix(line, prefix)[source]
optunaz.utils.tracking.round_scores(test_scores)[source]
class optunaz.utils.tracking.InternalTrackingCallback(optconfig, trial_number_offset)[source]

Bases: object

Callback to track (log) Optimization progress using internal tracking format

optconfig
trial_number_offset
class optunaz.utils.tracking.Datapoint(smiles: str, expected: float, predicted: float)[source]

Bases: object

smiles
expected
predicted
class optunaz.utils.tracking.Calpoint(bin_edges: float, frac_true: float, frac_pred: float)[source]

Bases: object

bin_edges
frac_true
frac_pred
class optunaz.utils.tracking.BuildTrackingData(response_column_name, test_scores, test_points, cal_points)[source]

Bases: object

Dataclass defining internal Build tracking format

response_column_name
test_scores
test_points
cal_points
optunaz.utils.tracking.track_build(qptuna_model, buildconfig, test_scores)[source]

Module contents

optunaz.utils.mkdict(obj)[source]
optunaz.utils.load_df_from_file(filename, smiles_col)[source]
optunaz.utils.remove_failed_idx(failed_idx, y_, smis, auxs)[source]
optunaz.utils.md5_hash(dictionary)[source]

MD5 hash of an optimisation algorithm or a model metadata dictionary