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
Store model in compressed format for persistance
cpu_count
create_models_path
directory_tree
explain
explain_stack
featurizer
Select a pipeline, for example, using HyperOpt.
Fit the stacked model.
fit_stack
Execute the any method on the configured HPC.
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 previously stored TargetMate instance.
Load base model
Load a base model
load_data
load_explanations
load_predictions
Check master key types
master_mapping
Calculate metric.
model_iterator
pca_fit
pca_transform
predict
predict_stack
prepare_data
prepare_for_ml
read_data
Read signatures
Return signatures as an ensemble
Return signatures in a stacked form from an already prestacked file
Return signatures in a stacked form
Redefine path of a TargetMate instance.
Redefine path of a TargetMate instance.
repath_predictions_by_fold_and_set
Redefine path of a TargetMate instance.
reset_path_bases
Reset predictions path
sampler
Save TargetMate instance
save_data
signaturize
Wait for jobs to finish
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