chemicalchecker.tool.targetmate.base.StackedModel

class StackedModel(n_components=None, **kwargs)[source]

Bases: SignaturedModel

Stacked TargetMate model.

Initialize the stacked model.

Methods

array_on_disk

check_array_from_disk

compress_models

Store model in compressed format for persistance

cpu_count

create_models_path

directory_tree

explain

explain_stack

featurizer

find_base_mod

Select a pipeline, for example, using HyperOpt.

fit

Fit the stacked model.

fit_stack

func_hpc

Execute the any method on the configured HPC.

get_Xy_from_data

Given data and certain idxs, get X and y (if available)

get_data_fit

get_data_predict

get_datasets

get_destination_dir

get_master_idxs

load

Load previously stored TargetMate instance.

load_base_mod

Load base model

load_base_model

Load a base model

load_data

load_explanations

load_predictions

master_key_type

Check master key types

master_mapping

metric_calc

Calculate metric.

model_iterator

pca_fit

pca_transform

predict

predict_stack

prepare_data

prepare_for_ml

read_data

read_signatures

Read signatures

read_signatures_ensemble

Return signatures as an ensemble

read_signatures_prestacked

Return signatures in a stacked form from an already prestacked file

read_signatures_stacked

Return signatures in a stacked form

repath_bases_by_fold

Redefine path of a TargetMate instance.

repath_predictions_by_fold

Redefine path of a TargetMate instance.

repath_predictions_by_fold_and_set

repath_predictions_by_set

Redefine path of a TargetMate instance.

reset_path_bases

reset_path_predictions

Reset predictions path

sampler

save

Save TargetMate instance

save_data

signaturize

waiter

Wait for jobs to finish

wipe

Delete temporary data

compress_models()

Store model in compressed format for persistance

find_base_mod(X, y, smiles, destination_dir)

Select a pipeline, for example, using HyperOpt.

fit(data, idxs=None, is_tmp=False, wait=True, scramble=False)[source]

Fit the stacked model.

Parameters:
  • data (InputData) – Input data.

  • idxs (array) – Indices to use for the signatures. If none specified, all are used (default=None).

  • is_tmp (bool) – Save in the temporary directory or in the models directory.

func_hpc(func_name, *args, **kwargs)

Execute the any method on the configured HPC.

Parameters:
  • args (tuple) – the arguments for of the function method

  • kwargs (dict) – arguments for the HPC method.

get_Xy_from_data(data, idxs, scramble=False)

Given data and certain idxs, get X and y (if available)

static load(models_path)

Load previously stored TargetMate instance.

load_base_mod()

Load base model

load_base_model(destination_dir, append_pipe=False)

Load a base model

master_key_type()

Check master key types

metric_calc(y_true, y_pred, metric=None)

Calculate metric. Returns (value, weight) tuple.

read_signatures(datasets=None, idxs=None, smiles=None, inchikeys=None, is_tmp=None, sign_folder=None)

Read signatures

read_signatures_ensemble(datasets, smiles, inchikeys, idxs, is_tmp, sign_folder)

Return signatures as an ensemble

read_signatures_prestacked(mask, datasets, smiles, inchikeys, idxs, is_tmp, sign_folder)

Return signatures in a stacked form from an already prestacked file

read_signatures_stacked(datasets, smiles, inchikeys, idxs, is_tmp, sign_folder)

Return signatures in a stacked form

repath_bases_by_fold(fold_number, is_tmp=True, reset=True, only_train=False)

Redefine path of a TargetMate instance. Used by the Validation class.

repath_predictions_by_fold(fold_number, is_tmp=True, reset=True)

Redefine path of a TargetMate instance. Used by the Validation class.

repath_predictions_by_set(is_train, is_tmp=True, reset=True)

Redefine path of a TargetMate instance. Used by the Validation class.

reset_path_predictions(is_tmp=True)

Reset predictions path

save()

Save TargetMate instance

waiter(jobs, secs=3)

Wait for jobs to finish

wipe()

Delete temporary data