deepmol.models package

Submodules

deepmol.models.base_models module

basic_multitask_dnn(input_shape, task_names, losses, metrics)[source]
create_dense_model(input_dim: int = 1024, n_hidden_layers: int = 1, layers_units: List[int] | None = None, dropouts: List[float] | None = None, activations: List[str] | None = None, batch_normalization: List[bool] | None = None, l1_l2: List[float] | None = None, loss: str = 'binary_crossentropy', optimizer: str = 'adam', metrics: List[str] | None = None)[source]

Builds a dense neural network model.

Parameters:
  • input_dim (int) – Number of features.

  • n_hidden_layers (int) – Number of hidden layers.

  • layers_units (List[int]) – Number of units in each hidden layer.

  • dropouts (List[float]) – Dropout rate in each hidden layer.

  • activations (List[str]) – Activation function in each hidden layer.

  • batch_normalization (List[bool]) – Whether to use batch normalization in each hidden layer.

  • l1_l2 (List[float]) – L1 and L2 regularization in each hidden layer.

  • loss (str) – Loss function.

  • optimizer (str) – Optimizer.

  • metrics (List[str]) – Metrics to be evaluated by the model during training and testing.

Returns:

model – Dense neural network model.

Return type:

Sequential

make_cnn_model(input_dim: int = 1024, g_noise: float = 0.05, DENSE: int = 128, DROPOUT: float = 0.5, C1_K: int = 8, C1_S: int = 32, C2_K: int = 16, C2_S: int = 32, activation: str = 'relu', loss: str = 'binary_crossentropy', optimizer: str = 'adadelta', learning_rate: float = 0.01, metrics: str | List[str] = 'accuracy')[source]

Builds a 1D convolutional neural network model.

Parameters:
  • input_dim (int) – Number of features.

  • g_noise (float) – Gaussian noise.

  • DENSE (int) – Number of units in the dense layer.

  • DROPOUT (float) – Dropout rate.

  • C1_K (int) – The dimensionality of the output space (i.e. the number of output filters in the convolution) of the first convolutional layer.

  • C1_S (int) – Kernel size specifying the length of the 1D convolution window of the first convolutional layer.

  • C2_K (int) – The dimensionality of the output space (i.e. the number of output filters in the convolution) of the second convolutional layer.

  • C2_S (int) – Kernel size specifying the length of the 1D convolution window of the second convolutional layer.

  • activation (str) – Activation function of the Conv1D and Dense layers.

  • loss (str) – Loss function.

  • optimizer (str) – Optimizer.

  • learning_rate (float) – Learning rate.

  • metrics (Union[str, List[str]]) – Metrics to be evaluated by the model during training and testing.

rf_model_builder(n_estimators: int = 100, max_features: int | float | str = 'auto', class_weight: dict | None = None)[source]

Builds a random forest model.

Parameters:
  • n_estimators (int) – Number of trees in the forest.

  • max_features (Union[int, float, str]) – The number of features to consider when looking for the best split: - If int, then consider max_features features at each split. - If float, then max_features is a percentage and int(max_features * n_features) features are considered at each split. - If “auto”, then max_features=sqrt(n_features). - If “sqrt”, then max_features=sqrt(n_features). - If “log2”, then max_features=log2(n_features). - If None, then max_features=n_features.

  • class_weight (dict) – Weights associated with classes in the form {class_label: weight}. If not given, all classes are supposed to have weight one.

Returns:

rf_model – Random forest model.

Return type:

RandomForestClassifier

svm_model_builder(C: float = 1.0, gamma: str | float = 'auto', kernel: str | callable = 'rfb')[source]

Builds a support vector machine model.

Parameters:
  • C (float) – Penalty parameter C of the error term.

  • gamma (Union[str, float]) –

    Kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’.
    • if ‘scale’ is passed then it uses 1 / (n_features * X.var()) as value of gamma;

    • if ‘auto’, uses 1 / n_features.

  • kernel (str) – Specifies the kernel type to be used in the algorithm. It must be one of ‘linear’, ‘poly’, ‘rbf’, ‘sigmoid’, ‘precomputed’ or a callable.

Returns:

svm_model – Support vector machine model.

Return type:

SVC

deepmol.models.deepchem_model_builders module

attentivefp_model(attentivefp_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for AttentiveFPModel from DeepChem. .. rubric:: References

Kaixian Chen, Hualiang Jiang, and Mingyue Zheng. “Pushing the Boundaries of Molecular Representation for Drug Discovery with the Graph Attention Mechanism.” Journal of Medicinal Chemistry. 2020, 63, 16, 8749–8760.

Parameters:
  • attentivefp_kwargs (dict) – Keyword arguments for AttentiveFPModel.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped AttentiveFPModel as DeepChemModel.

Return type:

DeepChemModel

check_if_cuda_is_available_for_dgl() bool[source]

Check if cuda is available for dgl.

chem_ception_model(chem_ception_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for ChemCeption from DeepChem. .. rubric:: References

Expert-developed QSAR/QSPR Models” (https://arxiv.org/pdf/1706.06689.pdf)

Parameters:
  • chem_ception_kwargs (dict) – Keyword arguments for ChemCeption.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped ChemCeption as DeepChemModel.

Return type:

DeepChemModel

cnn_model(cnn_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for CNN from DeepChem. .. rubric:: References

Parameters:
  • cnn_kwargs (dict) – Keyword arguments for CNN.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped CNN as DeepChemModel.

Return type:

DeepChemModel

dag_model(dag_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for DAGModel from DeepChem. .. rubric:: References

chemoinformatics: the prediction of aqueous solubility for drug-like molecules.” Journal of chemical information and modeling 53.7 (2013): 1563-1575.

Parameters:
  • dag_kwargs (dict) – Keyword arguments for DAGModel.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped DAGModel as DeepChemModel.

Return type:

DeepChemModel

dmpnn_model(dmpnn_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for DMPNNModel from DeepChem. .. rubric:: References

Parameters:
  • dmpnn_kwargs (dict) – Keyword arguments for DMPNNModel.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped DMPNNModel as DeepChemModel.

Return type:

DeepChemModel

dtnn_model(dtnn_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for DTNNModel from DeepChem. .. rubric:: References

8.1 (2017): 1-8.

Parameters:
  • dtnn_kwargs (dict) – Keyword arguments for DTNNModel.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped DTNNModel as DeepChemModel.

Return type:

DeepChemModel

gat_model(gat_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for GATModel from DeepChem. .. rubric:: References

“Graph Attention Networks.” ICLR 2018.

Parameters:
  • gat_kwargs (dict) – Keyword arguments for GATModel.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped GATModel as DeepChemModel.

Return type:

DeepChemModel

gcn_model(gcn_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for GCNModel from DeepChem. .. rubric:: References

Parameters:
  • gcn_kwargs (dict) – Keyword arguments for GCNModel.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped GCNModel as DeepChemModel.

Return type:

DeepChemModel

graph_conv_model(graph_conv_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for GraphConvModel from DeepChem. .. rubric:: References

neural information processing systems. 2015.

Parameters:
  • graph_conv_kwargs (dict) – Keyword arguments for GraphConvModel.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped GraphConvModel as DeepChemModel.

Return type:

DeepChemModel

mat_model(mat_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for MATModel from DeepChem. .. rubric:: References

Learning and the Physical Sciences workshop at NeurIPS 2019. 2020. https://arxiv.org/abs/2002.08264

Parameters:
  • mat_kwargs (dict) – Keyword arguments for MATModel.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped MATModel as DeepChemModel.

Return type:

DeepChemModel

megnet_model(megnet_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for MEGNetModel from DeepChem. .. rubric:: References

Chemistry of Materials 31.9 (2019): 3564-3572. - Battaglia, Peter W., et al. “Relational inductive biases, deep learning, and graph networks.” arXiv preprint arXiv:1806.01261 (2018).

Parameters:
  • megnet_kwargs (dict) – Keyword arguments for MEGNetModel.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped MEGNetModel as DeepChemModel.

Return type:

DeepChemModel

mpnn_model(mpnn_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for MPNNModel from DeepChem. .. rubric:: References

for Quantum Chemistry.” ICML 2017.

Parameters:
  • mpnn_kwargs (dict) – Keyword arguments for MPNNModel.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped MPNNModel as DeepChemModel.

Return type:

DeepChemModel

multitask_classifier_model(multitask_classifier_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for MultitaskClassifier from DeepChem. .. rubric:: References

Parameters:
  • multitask_classifier_kwargs (dict) – Keyword arguments for MultitaskClassifier.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped MultitaskClassifier as DeepChemModel.

Return type:

DeepChemModel

multitask_irv_classifier_model(multitask_irv_classifier_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for MultitaskIRVClassifier from DeepChem. .. rubric:: References

Parameters:
  • multitask_irv_classifier_kwargs (dict) – Keyword arguments for MultitaskIRVClassifier.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped MultitaskIRVClassifier as DeepChemModel.

Return type:

DeepChemModel

multitask_regressor_model(multitask_regressor_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for MultitaskRegressor from DeepChem. .. rubric:: References

Parameters:
  • multitask_regressor_kwargs (dict) – Keyword arguments for MultitaskRegressor.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped MultitaskRegressor as DeepChemModel.

Return type:

DeepChemModel

pagtn_model(patgn_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for PagtnModel from DeepChem. .. rubric:: References

Parameters:
  • patgn_kwargs (dict) – Keyword arguments for PagtnModel.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped PagtnModel as DeepChemModel.

Return type:

DeepChemModel

progressive_multitask_classifier_model(progressive_multitask_classifier_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for ProgressiveMultitaskClassifier from DeepChem. .. rubric:: References

Parameters:
  • progressive_multitask_classifier_kwargs (dict) – Keyword arguments for ProgressiveMultitaskClassifier.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped ProgressiveMultitaskClassifier as DeepChemModel.

Return type:

DeepChemModel

progressive_multitask_regressor_model(progressive_multitask_regressor_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for ProgressiveMultitaskRegressor from DeepChem. .. rubric:: References

Parameters:
  • progressive_multitask_regressor_kwargs (dict) – Keyword arguments for ProgressiveMultitaskRegressor.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped ProgressiveMultitaskRegressor as DeepChemModel.

Return type:

DeepChemModel

robust_multitask_classifier_model(robust_multitask_classifier_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for RobustMultitaskClassifier from DeepChem. .. rubric:: References

and modeling 57.8 (2017): 2068-2076.

Parameters:
  • robust_multitask_classifier_kwargs (dict) – Keyword arguments for RobustMultitaskClassifier.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped RobustMultitaskClassifier as DeepChemModel.

Return type:

DeepChemModel

robust_multitask_regressor_model(robust_multitask_regressor_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for RobustMultitaskRegressor from DeepChem. .. rubric:: References

and modeling 57.8 (2017): 2068-2076.

Parameters:
  • robust_multitask_regressor_kwargs (dict) – Keyword arguments for RobustMultitaskRegressor.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped RobustMultitaskRegressor as DeepChemModel.

Return type:

DeepChemModel

sc_score_model(sc_score_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for ScScoreModel from DeepChem. .. rubric:: References

Parameters:
  • sc_score_kwargs (dict) – Keyword arguments for ScScoreModel.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped ScScoreModel as DeepChemModel.

Return type:

DeepChemModel

smiles_to_vec_model(smiles_to_vec_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for Smiles2Vec from DeepChem. .. rubric:: References

Properties” (https://arxiv.org/pdf/1712.02034.pdf).

Parameters:
  • smiles_to_vec_kwargs (dict) – Keyword arguments for Smiles2Vec.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped Smiles2Vec as DeepChemModel.

Return type:

DeepChemModel

text_cnn_model(text_cnn_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for TextCNNModel from DeepChem. .. rubric:: References

generation models.” arXiv preprint arXiv:1705.10843 (2017). - Kim, Yoon. “Convolutional neural networks for sentence classification.” arXiv preprint arXiv:1408.5882 (2014).

Parameters:
  • text_cnn_kwargs (dict) – Keyword arguments for TextCNNModel.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped TextCNNModel as DeepChemModel.

Return type:

DeepChemModel

weave_model(weave_kwargs: dict | None = None, deepchem_kwargs: dict | None = None) DeepChemModel[source]

Deepmol wrapper for WeaveModel from DeepChem. .. rubric:: References

molecular design 30.8 (2016): 595-608.

Parameters:
  • weave_kwargs (dict) – Keyword arguments for WeaveModel.

  • deepchem_kwargs (dict) – Keyword arguments for DeepChemModel class.

Returns:

Wrapped WeaveModel as DeepChemModel.

Return type:

DeepChemModel

deepmol.models.deepchem_models module

class DeepChemModel(model: Model, model_dir: str | None = None, custom_objects: dict | None = None, **kwargs)[source]

Bases: Model, Predictor

Wrapper class that wraps deepchem models. The DeepChemModel class provides a wrapper around deepchem models that allows deepchem models to be trained on Dataset objects and evaluated with the metrics in Metrics.

cross_validate(dataset: Dataset, metric: Metric, splitter: Splitter | None = None, transformers: List[NormalizationTransformer] | None = None, folds: int = 3)[source]

Cross validates the model on the specified dataset.

Parameters:
  • dataset (Dataset) – Dataset to cross validate on.

  • metric (Metric) – Metric to evaluate the model on.

  • splitter (Splitter) – Splitter to use for cross validation.

  • transformers (List[Transformer]) – Transformers that the input data has been transformed by.

  • folds (int) – Number of folds to use for cross validation.

Returns:

The first element is the best model, the second is the train score of the best model, the third is the train score of the best model, the fourth is the test scores of all models, the fifth is the average train scores of all folds and the sixth is the average test score of all folds.

Return type:

Tuple[DeepChemModel, float, float, List[float], List[float], float, float]

evaluate(dataset: Dataset, metrics: List[Metric], per_task_metrics: bool = False)[source]

Evaluates the performance of the model on the provided dataset.

Parameters:
  • dataset (Dataset) – Dataset to evaluate the model on.

  • metrics (List[Metric]) – Metrics to evaluate the model on.

  • per_task_metrics (bool) – If true, return computed metric for each task on multitask dataset.

Returns:

multitask_scores: dict

Dictionary mapping names of metrics to metric scores.

all_task_scores: dict

If per_task_metrics == True, then returns a second dictionary of scores for each task separately.

Return type:

Tuple[Dict, Dict]

fit(dataset: Dataset)[source]

Fits the model on a dataset.

Parameters:

dataset (Dataset) – The Dataset to train this model on.

fit_on_batch(X: Sequence, y: Sequence, w: Sequence)[source]

Fits the model on a batch of data.

Parameters:
  • X (Sequence) – The input data.

  • y (Sequence) – The output data.

  • w (Sequence) – The weights for the data.

get_num_tasks() int[source]

Returns the number of tasks of the model.

Returns:

The number of tasks of the model.

Return type:

int

get_task_type() str[source]

Returns the task type of the model.

Returns:

The task type of the model.

Return type:

str

classmethod load(folder_path: str, **kwargs)[source]

Loads deepchem model from disk.

Parameters:
  • folder_path (str) – Path to the file where the model is stored.

  • kwargs (Dict) –

    Additional parameters. custom_objects: Dict

    Dictionary of custom objects to be passed to tensorflow.keras.utils.custom_object_scope.

model: Model
property model_type

Returns the type of the model.

predict(dataset: Dataset, transformers: List[NormalizationTransformer] | None = None) ndarray[source]

Makes predictions on dataset.

Parameters:
  • dataset (Dataset) – Dataset to make prediction on.

  • transformers (List[Transformer]) – Transformers that the input data has been transformed by. The output is passed through these transformers to undo the transformations.

Returns:

The value is a return value of predict method of the DeepChem model.

Return type:

np.ndarray

predict_on_batch(dataset: Dataset) ndarray[source]

Makes predictions on batch of data.

Parameters:

dataset (Dataset) – Dataset to make prediction on.

predict_proba(dataset: Dataset, transformers: List[NormalizationTransformer] | None = None) ndarray[source]

Makes predictions on dataset.

Parameters:
  • dataset (Dataset) – Dataset to make prediction on.

  • transformers (List[Transformer]) – Transformers that the input data has been transformed by. The output is passed through these transformers to undo the transformations.

Returns:

The value is a return value of predict method of the DeepChem model.

Return type:

np.ndarray

save(folder_path: str | None = None)[source]

Saves deepchem model to disk.

Parameters:

folder_path (str) – Path to the file where the model will be stored.

generate_sequences(epochs: int, train_smiles: List[str | int])[source]

Function to generate the input/output pairs for SeqToSeq model. Taken from DeepChem tutorials.

Parameters:
  • epochs (int) – Number of epochs to train the model.

  • train_smiles (List[str]) – The ids of the samples in the dataset (smiles)

Return type:

yields a pair of smile strings for epochs x len(train_smiles)

deepmol.models.ensembles module

class Ensemble(models: List[Model])[source]

Bases: ABC, Predictor

Abstract class for ensembles of models.

evaluate(dataset: Dataset, metrics: List[Metric], per_task_metrics: bool = False, n_classes: int = 2)[source]

Evaluates the performance of this model on specified dataset.

Parameters:
  • dataset (Dataset) – Dataset object.

  • metrics (List[Metric]) – The set of metrics provided.

  • per_task_metrics (bool) – If true, return computed metric for each task on multitask dataset.

  • n_classes (int) – If specified, will use n_classes as the number of unique classes.

Returns:

  • multitask_scores (dict) – Dictionary mapping names of metrics to metric scores.

  • all_task_scores (dict, optional) – If per_task_metrics == True is passed as a keyword argument, then returns a second dictionary of scores for each task separately.

fit(dataset: Dataset)[source]

Fits the models to the specified dataset.

abstract predict(dataset: Dataset)[source]

Predicts the labels for the specified dataset.

class VotingClassifier(models: List[Model], voting: str = 'soft')[source]

Bases: Ensemble

VotingClassifier Ensemble. It uses a voting strategy to predict the labels of a dataset.

predict(dataset: Dataset, proba: bool = False)[source]

Predicts the labels for the specified dataset.

Parameters:
  • dataset (Dataset) – Dataset object.

  • proba (bool) – If true, returns the probabilities instead of class labels.

Returns:

final_result – Predicted labels or probabilities.

Return type:

np.ndarray

deepmol.models.keras_model_builders module

keras_1d_cnn_model(model_kwargs: dict | None = None, keras_kwargs: dict | None = None) KerasModel[source]

Build a 1D convolutional neural network model using Keras.

Parameters:
  • model_kwargs (dict) – Keyword arguments for the model builder.

  • keras_kwargs (dict) – Keyword arguments for the Keras model.

Returns:

model – The built model.

Return type:

KerasModel

keras_1d_cnn_model_builder(input_dim: int, n_tasks: int = 1, label_names: List[str] | None = None, g_noise: float = 0.05, n_conv_layers: int = 2, filters: List[int] | None = None, kernel_sizes: List[int] | None = None, strides: List[int] | None = None, conv_activations: List[str] | None = None, conv_dropouts: List[float] | None = None, conv_batch_norms: List[bool] | None = None, padding: str = 'same', dense_units: int = 128, dense_activation: str = 'relu', dense_dropout: float = 0.5, last_layers_units: List[int] | None = None, last_layers_activations: List[str] | None = None, optimizer: str = 'adam', losses: List[str] | Dict[str, str] | None = None, metrics: List[str] | Dict[str, str] | None = None) Model[source]

Build a 1D convolutional neural network model using Keras.

Parameters:
  • input_dim (int) – Input dimension.

  • n_tasks (int) – Number of tasks.

  • label_names (List[str]) – List of label names.

  • g_noise (float) – Gaussian noise.

  • n_conv_layers (int) – Number of convolutional layers.

  • filters (List[int]) – List of filters.

  • kernel_sizes (List[int]) – List of kernel sizes.

  • strides (List[int]) – List of strides.

  • conv_activations (List[str]) – List of convolutional activations.

  • conv_dropouts (List[float]) – List of convolutional dropouts.

  • conv_batch_norms (List[bool]) – List of convolutional batch normalizations.

  • padding (str) – Padding.

  • dense_units (int) – Number of dense units.

  • dense_activation (str) – Dense activation.

  • dense_dropout (float) – Dense dropout.

  • last_layers_units (List[int]) – List of last layers units.

  • last_layers_activations (List[str]) – List of last layers activations.

  • optimizer (str) – Optimizer.

  • losses (Union[List[str], Dict[str, str]]) – Losses.

  • metrics (Union[List[str], Dict[str, str]]) – Metrics.

Returns:

model – The built model.

Return type:

Model

keras_bidirectional_rnn_model(model_kwargs: dict | None = None, keras_kwargs: dict | None = None) KerasModel[source]

Build a bidirectional RNN model using Keras.

Parameters:
  • model_kwargs (dict) – Keyword arguments for the model builder.

  • keras_kwargs (dict) – Keyword arguments for the Keras model.

Returns:

model – The built model.

Return type:

KerasModel

keras_bidirectional_rnn_model_builder(input_dim: int, n_tasks: int = 1, label_names: List[str] | None = None, n_lstm_layers: int = 1, lstm_units: List[int] | None = None, lstm_dropout: List[float] | None = None, n_gru_layers: int = 0, gru_units: List[int] | None = None, gru_dropout: List[float] | None = None, dense_units: int = 64, dense_dropout: float = 0.0, dense_activation: str = 'relu', last_layers_units: List[int] | None = None, last_layers_activations: List[str] | None = None, optimizer: str = 'adam', losses: List[str] | Dict[str, str] | None = None, metrics: List[str] | Dict[str, str] | None = None) Model[source]

Build a bidirectional RNN model using Keras.

Parameters:
  • input_dim (int) – Input dimension.

  • n_tasks (int) – Number of tasks.

  • label_names (List[str]) – Names of the labels.

  • n_lstm_layers (int) – Number of LSTM layers.

  • lstm_units (int) – Number of units in each LSTM layer.

  • lstm_dropout (float) – Dropout rate in each LSTM layer.

  • n_gru_layers (int) – Number of GRU layers.

  • gru_units (int) – Number of units in each GRU layer.

  • gru_dropout (float) – Dropout rate in each GRU layer.

  • dense_units (int) – Number of units in the dense layer.

  • dense_dropout (float) – Dropout rate in the dense layer.

  • dense_activation (str) – Activation function in the dense layer.

  • last_layers_units (List[int]) – Number of units in the last layers.

  • last_layers_activations (List[str]) – Activation functions in the last layers.

  • optimizer (str) – Optimizer.

  • losses (Union[List[str], Dict[str, str]]) – Loss functions.

  • metrics (Union[List[str], Dict[str, str]]) – Metrics.

Returns:

model – The built model.

Return type:

Model

keras_fcnn_model(model_kwargs: dict | None = None, keras_kwargs: dict | None = None) KerasModel[source]

Build a fully connected neural network model using Keras.

Parameters:
  • model_kwargs (dict) – Keyword arguments for the model builder.

  • keras_kwargs (dict) – Keyword arguments for the Keras model.

Returns:

model – The built model.

Return type:

KerasModel

keras_fcnn_model_builder(input_dim: int, n_tasks: int = 1, label_names: List[str] | None = None, n_hidden_layers: int = 1, hidden_units: List[int] | None = None, hidden_activations: List[str] | None = None, hidden_regularizers: List[Tuple[float, float]] | None = None, hidden_dropouts: List[float] | None = None, batch_normalization: List[bool] | None = None, last_layers_units: List[int] | None = None, last_layers_activations: List[str] | None = None, optimizer: str = 'adam', losses: List[str] | Dict[str, str] | None = None, metrics: List[str] | Dict[str, str] | None = None) Model[source]

Build a fully connected neural network model using Keras.

Parameters:
  • input_dim (int) – Dimension of the input layer.

  • n_tasks (int) – Number of tasks.

  • label_names (list of str) – Names of the labels.

  • n_hidden_layers (int) – Number of hidden layers.

  • hidden_units (list of int) – Number of units in each hidden layer.

  • hidden_activations (list of str) – Activation functions of each hidden layer.

  • hidden_regularizers (list of tuple of float) – Regularizers of each hidden layer.

  • hidden_dropouts (list of float) – Dropout rates of each hidden layer.

  • batch_normalization (list of bool) – Whether to use batch normalization in each hidden layer.

  • last_layers_units (list of int) – Number of units in each last layer.

  • last_layers_activations (list of str) – Activation functions of each last layer.

  • optimizer (str) – Optimizer.

  • losses (list of str or dict of str) – Loss functions.

  • metrics (list of str or dict of str) – Metrics.

Returns:

model – The built model.

Return type:

keras.Model

keras_rnn_model(model_kwargs: dict | None = None, keras_kwargs: dict | None = None) KerasModel[source]

Build a RNN model using Keras.

Parameters:
  • model_kwargs (dict) – Keyword arguments for the model builder.

  • keras_kwargs (dict) – Keyword arguments for the Keras model.

Returns:

model – The built model.

Return type:

KerasModel

keras_rnn_model_builder(input_dim: int, n_tasks: int = 1, label_names: List[str] | None = None, n_lstm_layers: int = 1, lstm_units: List[int] | None = None, lstm_dropout: List[float] | None = None, n_gru_layers: int = 0, gru_units: List[int] | None = None, gru_dropout: List[float] | None = None, dense_units: int = 64, dense_dropout: float = 0.0, dense_activation: str = 'relu', last_layers_units: List[int] | None = None, last_layers_activations: List[str] | None = None, optimizer: str = 'adam', losses: List[str] | Dict[str, str] | None = None, metrics: List[str] | Dict[str, str] | None = None) Model[source]

Build a RNN model using Keras.

Parameters:
  • input_dim (int) – Dimension of the input.

  • n_tasks (int) – Number of tasks.

  • label_names (List[str]) – List of label names.

  • n_lstm_layers (int) – Number of LSTM layers.

  • lstm_units (int) – Number of units in the LSTM layers.

  • lstm_dropout (float) – Dropout rate in the LSTM layers.

  • n_gru_layers (int) – Number of GRU layers.

  • gru_units (int) – Number of units in the GRU layers.

  • gru_dropout (float) – Dropout rate in the GRU layers.

  • dense_units (int) – Number of units in the dense layers.

  • dense_dropout (float) – Dropout rate in the dense layers.

  • dense_activation (str) – Activation function in the dense layers.

  • last_layers_units (List[int]) – Number of units in the last layers.

  • last_layers_activations (List[str]) – Activation functions in the last layers.

  • optimizer (str) – Optimizer.

  • losses (Union[List[str], Dict[str, str]]) – Loss functions.

  • metrics (Union[List[str], Dict[str, str]]) – Metrics.

Returns:

model – The built model.

Return type:

Model

keras_simple_rnn_model(model_kwargs: dict | None = None, keras_kwargs: dict | None = None) KerasModel[source]

Build a simple RNN model using Keras.

Parameters:
  • model_kwargs (dict) – Keyword arguments for the model builder.

  • keras_kwargs (dict) – Keyword arguments for the Keras model.

Returns:

model – The built model.

Return type:

KerasModel

keras_simple_rnn_model_builder(input_dim: int, n_tasks: int = 1, label_names: List[str] | None = None, n_rnn_layers: int = 1, rnn_units: List[int] | None = None, rnn_dropouts: List[float] | None = None, dense_units: int = 64, dense_activation: str = 'relu', dense_dropout: float = 0.1, last_layers_units: List[int] | None = None, last_layers_activations: List[str] | None = None, optimizer: str = 'adam', losses: List[str] | Dict[str, str] | None = None, metrics: List[str] | Dict[str, str] | None = None) Model[source]

Build a simple RNN model using Keras.

Parameters:
  • input_dim (int) – Input dimension.

  • n_tasks (int) – Number of tasks.

  • label_names (List[str]) – List of label names.

  • n_rnn_layers (int) – Number of RNN layers.

  • rnn_units (List[int]) – List of units in the RNN layers.

  • rnn_dropouts (List[float]) – List of dropout rates in the RNN layers.

  • dense_units (int) – Number of units in the dense layer.

  • dense_activation (str) – Activation function of the dense layer.

  • dense_dropout (float) – Dropout rate in the dense layer.

  • last_layers_units (List[int]) – List of units in the last layers.

  • last_layers_activations (List[str]) – List of activation functions in the last layers.

  • optimizer (str) – Optimizer.

  • losses (Union[List[str], Dict[str, str]]) – Losses.

  • metrics (Union[List[str], Dict[str, str]]) – Metrics.

Returns:

model – The built model.

Return type:

Model

keras_tabular_transformer_model(model_kwargs: dict | None = None, keras_kwargs: dict | None = None) KerasModel[source]

Build a transformer model using Keras.

Parameters:
  • model_kwargs (dict) – Keyword arguments for the model builder.

  • keras_kwargs (dict) – Keyword arguments for the Keras model.

Returns:

model – The built model.

Return type:

KerasModel

keras_tabular_transformer_model_builder(input_dim: int, n_tasks: int = 1, label_names: List[str] | None = None, embedding_output_dim: int = 32, n_attention_layers: int = 2, n_attention_heads: int = 4, attention_dropouts: List[float] | None = None, attention_key_dims: List[int] | None = None, dense_units: int = 64, dense_activation: str = 'relu', dense_dropout: float = 0.1, last_layers_units: List[int] | None = None, last_layers_activations: List[str] | None = None, optimizer: str = 'adam', losses: List[str] | Dict[str, str] | None = None, metrics: List[str] | Dict[str, str] | None = None) Model[source]

Build a transformer model using Keras.

Parameters:
  • input_dim (int) – Input dimension.

  • n_tasks (int) – Number of tasks.

  • label_names (List[str]) – List of label names.

  • embedding_output_dim (int) – Output dimension of the embedding layer.

  • n_attention_layers (int) – Number of attention layers.

  • n_attention_heads (int) – Number of attention heads.

  • attention_dropouts (List[float]) – List of attention dropouts.

  • attention_key_dims (List[int]) – List of attention key dimensions.

  • dense_units (int) – Number of units in the dense layer.

  • dense_activation (str) – Activation function for the dense layer.

  • dense_dropout (float) – Dropout rate for the dense layer.

  • last_layers_units (List[int]) – List of units in the last layers.

  • last_layers_activations (List[str]) – List of activation functions for the last layers.

  • optimizer (str) – Optimizer.

  • losses (Union[List[str], Dict[str, str]]) – List of losses or dictionary of losses per task.

  • metrics (Union[List[str], Dict[str, str]]) – List of metrics or dictionary of metrics per task.

Returns:

model – The built model.

Return type:

Model

deepmol.models.keras_models module

class KerasModel(model_builder: callable, mode: str | list = 'classification', model_dir: str | None = None, epochs: int = 150, batch_size: int = 10, verbose: int = 0, **kwargs)[source]

Bases: Model

Wrapper class that wraps keras models. The KerasModel class provides a wrapper around keras models that allows this models to be trained on Dataset objects.

cross_validate(dataset: Dataset, metric: Metric, splitter: Splitter | None = None, folds: int = 3)[source]

Cross validates the model on a dataset.

Parameters:
  • dataset (Dataset) – The Dataset to cross validate on.

  • metric (Metric) – The metric to use for cross validation.

  • splitter (Splitter) – The splitter to use for cross validation.

  • folds (int) – The number of folds to use for cross validation.

Returns:

The first element is the best model, the second is the train score of the best model, the third is the train score of the best model, the fourth is the test scores of all models, the fifth is the average train scores of all folds and the sixth is the average test score of all folds.

Return type:

Tuple[SKlearnModel, float, float, List[float], List[float], float, float]

fit_on_batch(dataset: Dataset) None[source]

Fits model on batch of data.

Parameters:

dataset (Dataset) – Dataset to fit model on.

get_num_tasks() int[source]

Returns the number of tasks of the model.

get_task_type() str[source]

Returns the task type of the model.

classmethod load(folder_path: str) KerasModel[source]

Reloads the model from disk.

Parameters:

folder_path (str) – The folder path to load the model from.

Returns:

The loaded model.

Return type:

KerasModel

property model_type

Returns the type of the model.

predict(dataset: Dataset) ndarray[source]

Makes predictions on dataset.

Parameters:

dataset (Dataset) – Dataset to make prediction on.

Returns:

The value is a return value of predict_proba or predict method of the scikit-learn model. If the scikit-learn model has both methods, the value is always a return value of predict_proba.

Return type:

np.ndarray

predict_on_batch(dataset: Dataset) ndarray[source]

Makes predictions on batch of data.

Parameters:

dataset (Dataset) – Dataset to make prediction on.

Returns:

numpy array of predictions.

Return type:

np.ndarray

predict_proba(dataset: Dataset) ndarray[source]

Makes predictions on dataset.

Parameters:

dataset (Dataset) – Dataset to make prediction on.

Returns:

predictions

Return type:

np.ndarray

save(file_path: str | None = None) None[source]

Saves the model to disk.

Parameters:

file_path (str) – The path to save the model to.

deepmol.models.models module

class Model(model: BaseEstimator | None = None, model_dir: str | None = None, **kwargs)[source]

Bases: BaseEstimator, Predictor, ABC

Abstract base class for ML/DL models.

evaluate(dataset: Dataset, metrics: List[Metric] | Metric, per_task_metrics: bool = False) Tuple[Dict, None | Dict][source]

Evaluates the performance of this model on specified dataset.

Parameters:
  • dataset (Dataset) – Dataset object.

  • metrics (Union[List[Metric], Metric]) – The set of metrics provided.

  • per_task_metrics (bool) – If true, return computed metric for each task on multitask dataset.

  • kwargs – Additional keyword arguments to pass to Evaluator.compute_model_performance.

Returns:

  • multitask_scores (dict) – Dictionary mapping names of metrics to metric scores.

  • all_task_scores (dict, optional) – If per_task_metrics == True is passed as a keyword argument, then returns a second dictionary of scores for each task separately.

fit_on_batch(dataset: Dataset) None[source]

Perform a single step of training.

Parameters:

dataset (Dataset) – Dataset object.

static get_model_filename(model_dir: str) str[source]

Given model directory, obtain filename for the model itself.

Parameters:

model_dir (str) – Path to directory where model is stored.

Returns:

Path to model file.

Return type:

str

get_num_tasks() int[source]

Get number of tasks.

static get_params_filename(model_dir: str) str[source]

Given model directory, obtain filename for the model itself.

Parameters:

model_dir (str) – Path to directory where model is stored.

Returns:

Path to file where model parameters are stored.

Return type:

str

get_task_type() str[source]

Currently models can only be classifiers or regressors.

classmethod load(folder_path: str) Model[source]

Reload trained model from disk.

Parameters:

folder_path (str) – Path to folder where model is stored.

Returns:

Model object.

Return type:

Model

predict(dataset: Dataset) ndarray[source]

Uses self to make predictions on provided Dataset object.

Parameters:

dataset (Dataset) – Dataset to make prediction on

Returns:

A numpy array of predictions.

Return type:

np.ndarray

predict_on_batch(dataset: Dataset) ndarray[source]

Makes predictions on given batch of new data.

Parameters:

dataset (Dataset) – Dataset object.

Returns:

Predicted values.

Return type:

np.ndarray

predict_proba(dataset: Dataset) ndarray[source]

Uses self to make predictions on provided Dataset object.

Parameters:

dataset (Dataset) – Dataset to make prediction on

Returns:

A numpy array of predictions.

Return type:

np.ndarray

save(file_path: str | None = None) None[source]

Function for saving models. Each subclass is responsible for overriding this method.

Parameters:

file_path (str) – Path to file where model should be saved.

deepmol.models.sklearn_model_builders module

ada_boost_classifier_model(ada_boost_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.AdaBoostClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.AdaBoostClassifier.html

Parameters:
  • ada_boost_classifier_kwargs (dict) – Keyword arguments for sklearn.ensemble.AdaBoostClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.AdaBoostClassifier

Return type:

SklearnModel

ada_boost_regressor_model(ada_boost_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.AdaBoostRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.AdaBoostRegressor.html

Parameters:
  • ada_boost_regressor_kwargs (dict) – Keyword arguments for sklearn.ensemble.AdaBoostRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.AdaBoostRegressor

Return type:

SklearnModel

ard_regression_model(ard_regression_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.ARDRegression. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.ARDRegression.html

Parameters:
  • ard_regression_kwargs (dict) – Keyword arguments for sklearn.linear_model.ARDRegression

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.ARDRegression

Return type:

SklearnModel

bagging_classifier_model(bagging_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.BaggingClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.BaggingClassifier.html

Parameters:
  • bagging_classifier_kwargs (dict) – Keyword arguments for sklearn.ensemble.BaggingClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.BaggingClassifier

Return type:

SklearnModel

bagging_regressor_model(bagging_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.BaggingRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.BaggingRegressor.html

Parameters:
  • bagging_regressor_kwargs (dict) – Keyword arguments for sklearn.ensemble.BaggingRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.BaggingRegressor

Return type:

SklearnModel

bayesian_ridge_model(bayesian_ridge_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.BayesianRidge. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.BayesianRidge.html

Parameters:
  • bayesian_ridge_kwargs (dict) – Keyword arguments for sklearn.linear_model.BayesianRidge

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.BayesianRidge

Return type:

SklearnModel

bernoulli_nb_model(bernoulli_nb_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.naive_bayes.BernoulliNB. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.BernoulliNB.html

Parameters:
  • bernoulli_nb_kwargs (dict) – Keyword arguments for sklearn.naive_bayes.BernoulliNB

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.naive_bayes.BernoulliNB

Return type:

SklearnModel

categorical_nb_model(categorical_nb_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.naive_bayes.CategoricalNB. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.CategoricalNB.html

Parameters:
  • categorical_nb_kwargs (dict) – Keyword arguments for sklearn.naive_bayes.CategoricalNB

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.naive_bayes.CategoricalNB

Return type:

SklearnModel

classifier_chain_model(classifier_chain_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.multioutput.ClassifierChain. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.multioutput.ClassifierChain.html

Parameters:
  • classifier_chain_kwargs (dict) – Keyword arguments for sklearn.multioutput.ClassifierChain

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.multioutput.ClassifierChain

Return type:

SklearnModel

complement_nb_model(complement_nb_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.naive_bayes.ComplementNB. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.ComplementNB.html

Parameters:
  • complement_nb_kwargs (dict) – Keyword arguments for sklearn.naive_bayes.ComplementNB

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.naive_bayes.ComplementNB

Return type:

SklearnModel

decision_tree_classifier_model(decision_tree_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.tree.DecisionTreeClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html

Parameters:
  • decision_tree_classifier_kwargs (dict) – Keyword arguments for sklearn.tree.DecisionTreeClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.tree.DecisionTreeClassifier

Return type:

SklearnModel

decision_tree_regressor_model(decision_tree_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.tree.DecisionTreeRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeRegressor.html

Parameters:
  • decision_tree_regressor_kwargs (dict) – Keyword arguments for sklearn.tree.DecisionTreeRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.tree.DecisionTreeRegressor

Return type:

SklearnModel

elastic_net_model(elastic_net_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.ElasticNet. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.ElasticNet.html

Parameters:
  • elastic_net_kwargs (dict) – Keyword arguments for sklearn.linear_model.ElasticNet

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.ElasticNet

Return type:

SklearnModel

extra_tree_classifier_model(extra_tree_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.tree.ExtraTreeClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.tree.ExtraTreeClassifier.html

Parameters:
  • extra_tree_classifier_kwargs (dict) – Keyword arguments for sklearn.tree.ExtraTreeClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.tree.ExtraTreeClassifier

Return type:

SklearnModel

extra_tree_regressor_model(extra_tree_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.tree.ExtraTreeRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.tree.ExtraTreeRegressor.html

Parameters:
  • extra_tree_regressor_kwargs (dict) – Keyword arguments for sklearn.tree.ExtraTreeRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.tree.ExtraTreeRegressor

Return type:

SklearnModel

extra_trees_classifier_model(extra_trees_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.ExtraTreesClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.ExtraTreesClassifier.html

Parameters:
  • extra_trees_classifier_kwargs (dict) – Keyword arguments for sklearn.ensemble.ExtraTreesClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.ExtraTreesClassifier

Return type:

SklearnModel

extra_trees_regressor_model(extra_trees_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.ExtraTreesRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.ExtraTreesRegressor.html

Parameters:
  • extra_trees_regressor_kwargs (dict) – Keyword arguments for sklearn.ensemble.ExtraTreesRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.ExtraTreesRegressor

Return type:

SklearnModel

gamma_regressor_model(gamma_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.GammaRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.GammaRegressor.html

Parameters:
  • gamma_regressor_kwargs (dict) – Keyword arguments for sklearn.linear_model.GammaRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.GammaRegressor

Return type:

SklearnModel

gaussian_nb_model(gaussian_nb_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.naive_bayes.GaussianNB. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.GaussianNB.html

Parameters:
  • gaussian_nb_kwargs (dict) – Keyword arguments for sklearn.naive_bayes.GaussianNB

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.naive_bayes.GaussianNB

Return type:

SklearnModel

gaussian_process_classifier_model(gaussian_process_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.gaussian_process.GaussianProcessClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.gaussian_process.GaussianProcessClassifier.html

Parameters:
  • gaussian_process_classifier_kwargs (dict) – Keyword arguments for sklearn.gaussian_process.GaussianProcessClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.gaussian_process.GaussianProcessClassifier

Return type:

SklearnModel

gaussian_process_regressor_model(gaussian_process_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.gaussian_process.GaussianProcessRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.gaussian_process.GaussianProcessRegressor.html

Parameters:
  • gaussian_process_regressor_kwargs (dict) – Keyword arguments for sklearn.gaussian_process.GaussianProcessRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.gaussian_process.GaussianProcessRegressor

Return type:

SklearnModel

gradient_boosting_classifier_model(gradient_boosting_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.GradientBoostingClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html

Parameters:
  • gradient_boosting_classifier_kwargs (dict) – Keyword arguments for sklearn.ensemble.GradientBoostingClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.GradientBoostingClassifier

Return type:

SklearnModel

gradient_boosting_regressor_model(gradient_boosting_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.GradientBoostingRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingRegressor.html

Parameters:
  • gradient_boosting_regressor_kwargs (dict) – Keyword arguments for sklearn.ensemble.GradientBoostingRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.GradientBoostingRegressor

Return type:

SklearnModel

hist_gradient_boosting_classifier_model(hist_gradient_boosting_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.HistGradientBoostingClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.HistGradientBoostingClassifier.html

Parameters:
  • hist_gradient_boosting_classifier_kwargs (dict) – Keyword arguments for sklearn.ensemble.HistGradientBoostingClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.HistGradientBoostingClassifier

Return type:

SklearnModel

hist_gradient_boosting_regressor_model(hist_gradient_boosting_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.HistGradientBoostingRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.HistGradientBoostingRegressor.html

Parameters:
  • hist_gradient_boosting_regressor_kwargs (dict) – Keyword arguments for sklearn.ensemble.HistGradientBoostingRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.HistGradientBoostingRegressor

Return type:

SklearnModel

huber_regressor_model(huber_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.HuberRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.HuberRegressor.html

Parameters:
  • huber_regressor_kwargs (dict) – Keyword arguments for sklearn.linear_model.HuberRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.HuberRegressor

Return type:

SklearnModel

isotonic_regression_model(isotonic_regression_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.isotonic.IsotonicRegression. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.isotonic.IsotonicRegression.html

Parameters:
  • isotonic_regression_kwargs (dict) – Keyword arguments for sklearn.isotonic.IsotonicRegression

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.isotonic.IsotonicRegression

Return type:

SklearnModel

kernel_ridge_regressor_model(kernel_ridge_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.kernel_ridge.KernelRidge. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.kernel_ridge.KernelRidge.html

Parameters:
  • kernel_ridge_regressor_kwargs (dict) – Keyword arguments for sklearn.kernel_ridge.KernelRidge

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.kernel_ridge.KernelRidge

Return type:

SklearnModel

kneighbors_classifier_model(kneighbors_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.neighbors.KNeighborsClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html

Parameters:
  • kneighbors_classifier_kwargs (dict) – Keyword arguments for sklearn.neighbors.KNeighborsClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.neighbors.KNeighborsClassifier

Return type:

SklearnModel

kneighbors_regressor_model(kneighbors_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.neighbors.KNeighborsRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsRegressor.html

Parameters:
  • kneighbors_regressor_kwargs (dict) – Keyword arguments for sklearn.neighbors.KNeighborsRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.neighbors.KNeighborsRegressor

Return type:

SklearnModel

label_propagation_model(label_propagation_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.semi_supervised.LabelPropagation. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.semi_supervised.LabelPropagation.html

Parameters:
  • label_propagation_kwargs (dict) – Keyword arguments for sklearn.semi_supervised.LabelPropagation

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.semi_supervised.LabelPropagation

Return type:

SklearnModel

label_spreading_model(label_spreading_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.semi_supervised.LabelSpreading. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.semi_supervised.LabelSpreading.html

Parameters:
  • label_spreading_kwargs (dict) – Keyword arguments for sklearn.semi_supervised.LabelSpreading

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.semi_supervised.LabelSpreading

Return type:

SklearnModel

lasso_cv_model(lasso_cv_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.LassoCV. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LassoCV.html

Parameters:
  • lasso_cv_kwargs (dict) – Keyword arguments for sklearn.linear_model.LassoCV

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.LassoCV

Return type:

SklearnModel

lasso_lars_cv_model(lasso_lars_cv_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.LassoLarsCV. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LassoLarsCV.html

Parameters:
  • lasso_lars_cv_kwargs (dict) – Keyword arguments for sklearn.linear_model.LassoLarsCV

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.LassoLarsCV

Return type:

SklearnModel

lasso_lars_ic_model(lasso_lars_ic_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.LassoLarsIC. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LassoLarsIC.html

Parameters:
  • lasso_lars_ic_kwargs (dict) – Keyword arguments for sklearn.linear_model.LassoLarsIC

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.LassoLarsIC

Return type:

SklearnModel

lasso_model(lasso_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.Lasso. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Lasso.html

Parameters:
  • lasso_kwargs (dict) – Keyword arguments for sklearn.linear_model.Lasso

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.Lasso

Return type:

SklearnModel

linear_discriminant_analysis_model(linear_discriminant_analysis_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.discriminant_analysis.LinearDiscriminantAnalysis. Reference:

Parameters:
  • linear_discriminant_analysis_kwargs (dict) – Keyword arguments for sklearn.discriminant_analysis.LinearDiscriminantAnalysis

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.discriminant_analysis.LinearDiscriminantAnalysis

Return type:

SklearnModel

linear_regression_model(linear_regression_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.LinearRegression. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html

Parameters:
  • linear_regression_kwargs (dict) – Keyword arguments for sklearn.linear_model.LinearRegression

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.LinearRegression

Return type:

SklearnModel

linear_svc_model(linear_svc_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.svm.LinearSVC. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.svm.LinearSVC.html

Parameters:
  • linear_svc_kwargs (dict) – Keyword arguments for sklearn.svm.LinearSVC

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.svm.LinearSVC

Return type:

SklearnModel

linear_svr_model(linear_svr_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.svm.LinearSVR. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.svm.LinearSVR.html

Parameters:
  • linear_svr_kwargs (dict) – Keyword arguments for sklearn.svm.LinearSVR

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.svm.LinearSVR

Return type:

SklearnModel

logistic_regression_cv_model(logistic_regression_cv_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.LogisticRegressionCV. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegressionCV.html

Parameters:
  • logistic_regression_cv_kwargs (dict) – Keyword arguments for sklearn.linear_model.LogisticRegressionCV

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.LogisticRegressionCV

Return type:

SklearnModel

logistic_regression_model(logistic_regression_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.LogisticRegression. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html

Parameters:
  • logistic_regression_kwargs (dict) – Keyword arguments for sklearn.linear_model.LogisticRegression

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.LogisticRegression

Return type:

SklearnModel

mlp_classifier_model(mlp_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.neural_network.MLPClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPClassifier.html

Parameters:
  • mlp_classifier_kwargs (dict) – Keyword arguments for sklearn.neural_network.MLPClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.neural_network.MLPClassifier

Return type:

SklearnModel

mlp_regressor_model(mlp_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.neural_network.MLPRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPRegressor.html

Parameters:
  • mlp_regressor_kwargs (dict) – Keyword arguments for sklearn.neural_network.MLPRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.neural_network.MLPRegressor

Return type:

SklearnModel

multi_output_classifier_model(multi_output_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.multioutput.MultiOutputClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.multioutput.MultiOutputClassifier.html

Parameters:
  • multi_output_classifier_kwargs (dict) – Keyword arguments for sklearn.multioutput.MultiOutputClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.multioutput.MultiOutputClassifier

Return type:

SklearnModel

multi_output_regressor_model(multi_output_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.multioutput.MultiOutputRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.multioutput.MultiOutputRegressor.html

Parameters:
  • multi_output_regressor_kwargs (dict) – Keyword arguments for sklearn.multioutput.MultiOutputRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.multioutput.MultiOutputRegressor

Return type:

SklearnModel

multinomial_nb_model(multinomial_nb_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.naive_bayes.MultinomialNB. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.MultinomialNB.html

Parameters:
  • multinomial_nb_kwargs (dict) – Keyword arguments for sklearn.naive_bayes.MultinomialNB

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.naive_bayes.MultinomialNB

Return type:

SklearnModel

multitask_elastic_net_cv_model(multitask_elastic_net_cv_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.MultiTaskElasticNetCV. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.MultiTaskElasticNetCV.html

Parameters:
  • multitask_elastic_net_cv_kwargs (dict) – Keyword arguments for sklearn.linear_model.MultiTaskElasticNetCV

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.MultiTaskElasticNetCV

Return type:

SklearnModel

multitask_elastic_net_model(multitask_elastic_net_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.MultiTaskElasticNet. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.MultiTaskElasticNet.html

Parameters:
  • multitask_elastic_net_kwargs (dict) – Keyword arguments for sklearn.linear_model.MultiTaskElasticNet

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.MultiTaskElasticNet

Return type:

SklearnModel

multitask_lasso_model(multitask_lasso_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.MultiTaskLasso. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.MultiTaskLasso.html

Parameters:
  • multitask_lasso_kwargs (dict) – Keyword arguments for sklearn.linear_model.MultiTaskLasso

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.MultiTaskLasso

Return type:

SklearnModel

nearest_centroid_model(nearest_centroid_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.neighbors.NearestCentroid. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.NearestCentroid.html

Parameters:
  • nearest_centroid_kwargs (dict) – Keyword arguments for sklearn.neighbors.NearestCentroid

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.neighbors.NearestCentroid

Return type:

SklearnModel

nu_svc_model(nu_svc_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.svm.NuSVC. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.svm.NuSVC.html

Parameters:
  • nu_svc_kwargs (dict) – Keyword arguments for sklearn.svm.NuSVC

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.svm.NuSVC

Return type:

SklearnModel

nu_svr_model(nu_svr_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.svm.NuSVR. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.svm.NuSVR.html

Parameters:
  • nu_svr_kwargs (dict) – Keyword arguments for sklearn.svm.NuSVR

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.svm.NuSVR

Return type:

SklearnModel

one_class_svm_model(one_class_svm_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.svm.OneClassSVM. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.svm.OneClassSVM.html

Parameters:
  • one_class_svm_kwargs (dict) – Keyword arguments for sklearn.svm.OneClassSVM

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.svm.OneClassSVM

Return type:

SklearnModel

one_vs_one_classifier_model(one_vs_one_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.multiclass.OneVsOneClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.multiclass.OneVsOneClassifier.html

Parameters:
  • one_vs_one_classifier_kwargs (dict) – Keyword arguments for sklearn.multiclass.OneVsOneClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.multiclass.OneVsOneClassifier

Return type:

SklearnModel

one_vs_rest_classifier_model(one_vs_rest_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.multiclass.OneVsRestClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.multiclass.OneVsRestClassifier.html

Parameters:
  • one_vs_rest_classifier_kwargs (dict) – Keyword arguments for sklearn.multiclass.OneVsRestClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.multiclass.OneVsRestClassifier

Return type:

SklearnModel

ortogonal_matching_pursuit_model(ortogonal_matching_pursuit_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.OrthogonalMatchingPursuit. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.OrthogonalMatchingPursuit.html

Parameters:
  • ortogonal_matching_pursuit_kwargs (dict) – Keyword arguments for sklearn.linear_model.OrthogonalMatchingPursuit

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.OrthogonalMatchingPursuit

Return type:

SklearnModel

output_code_classifier_model(output_code_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.multiclass.OutputCodeClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.multiclass.OutputCodeClassifier.html

Parameters:
  • output_code_classifier_kwargs (dict) – Keyword arguments for sklearn.multiclass.OutputCodeClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.multiclass.OutputCodeClassifier

Return type:

SklearnModel

passive_aggressive_classifier_model(passive_aggressive_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.PassiveAggressiveClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.PassiveAggressiveClassifier.html

Parameters:
  • passive_aggressive_classifier_kwargs (dict) – Keyword arguments for sklearn.linear_model.PassiveAggressiveClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.PassiveAggressiveClassifier

Return type:

SklearnModel

passive_aggressive_regressor_model(passive_aggressive_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.PassiveAggressiveRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.PassiveAggressiveRegressor.html

Parameters:
  • passive_aggressive_regressor_kwargs (dict) – Keyword arguments for sklearn.linear_model.PassiveAggressiveRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.PassiveAggressiveRegressor

Return type:

SklearnModel

perceptron_model(perceptron_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.Perceptron. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Perceptron.html

Parameters:
  • perceptron_kwargs (dict) – Keyword arguments for sklearn.linear_model.Perceptron

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.Perceptron

Return type:

SklearnModel

pls_regression_model(pls_regression_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.cross_decomposition.PLSRegression. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.cross_decomposition.PLSRegression.html

Parameters:
  • pls_regression_kwargs (dict) – Keyword arguments for sklearn.cross_decomposition.PLSRegression

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.cross_decomposition.PLSRegression

Return type:

SklearnModel

poisson_regressor_model(poisson_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.PoissonRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.PoissonRegressor.html

Parameters:
  • poisson_regressor_kwargs (dict) – Keyword arguments for sklearn.linear_model.PoissonRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.PoissonRegressor

Return type:

SklearnModel

quadratic_discriminant_analysis_model(quadratic_discriminant_analysis_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis. Reference:

Parameters:
  • quadratic_discriminant_analysis_kwargs (dict) – Keyword arguments for sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.discriminant_analysis.QuadraticDiscriminantAnalysis

Return type:

SklearnModel

quantile_regressor_model(quantile_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.QuantileRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.QuantileRegressor.html

Parameters:
  • quantile_regressor_kwargs (dict) – Keyword arguments for sklearn.linear_model.QuantileRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.QuantileRegressor

Return type:

SklearnModel

radius_neighbors_classifier_model(radius_neighbors_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.neighbors.RadiusNeighborsClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.RadiusNeighborsClassifier.html

Parameters:
  • radius_neighbors_classifier_kwargs (dict) – Keyword arguments for sklearn.neighbors.RadiusNeighborsClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.neighbors.RadiusNeighborsClassifier

Return type:

SklearnModel

radius_neighbors_regressor_model(radius_neighbors_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.neighbors.RadiusNeighborsRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.RadiusNeighborsRegressor.html

Parameters:
  • radius_neighbors_regressor_kwargs (dict) – Keyword arguments for sklearn.neighbors.RadiusNeighborsRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.neighbors.RadiusNeighborsRegressor

Return type:

SklearnModel

random_forest_classifier_model(random_forest_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.RandomForestClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html

Parameters:
  • random_forest_classifier_kwargs (dict) – Keyword arguments for sklearn.ensemble.RandomForestClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.RandomForestClassifier

Return type:

SklearnModel

random_forest_regressor_model(random_forest_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.RandomForestRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestRegressor.html

Parameters:
  • random_forest_regressor_kwargs (dict) – Keyword arguments for sklearn.ensemble.RandomForestRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.RandomForestRegressor

Return type:

SklearnModel

ransac_regressor_model(ransac_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.RANSACRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.RANSACRegressor.html

Parameters:
  • ransac_regressor_kwargs (dict) – Keyword arguments for sklearn.linear_model.RANSACRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.RANSACRegressor

Return type:

SklearnModel

regressor_chain_model(regressor_chain_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.multioutput.RegressorChain. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.multioutput.RegressorChain.html

Parameters:
  • regressor_chain_kwargs (dict) – Keyword arguments for sklearn.multioutput.RegressorChain

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.multioutput.RegressorChain

Return type:

SklearnModel

ridge_classifier_cv_model(ridge_classifier_cv_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.RidgeClassifierCV. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.RidgeClassifierCV.html

Parameters:
  • ridge_classifier_cv_kwargs (dict) – Keyword arguments for sklearn.linear_model.RidgeClassifierCV

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.RidgeClassifierCV

Return type:

SklearnModel

ridge_classifier_model(ridge_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.RidgeClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.RidgeClassifier.html

Parameters:
  • ridge_classifier_kwargs (dict) – Keyword arguments for sklearn.linear_model.RidgeClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.RidgeClassifier

Return type:

SklearnModel

ridge_cv_model(ridge_cv_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.RidgeCV. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.RidgeCV.html

Parameters:
  • ridge_cv_kwargs (dict) – Keyword arguments for sklearn.linear_model.RidgeCV

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.RidgeCV

Return type:

SklearnModel

ridge_model(ridge_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.Ridge. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.Ridge.html

Parameters:
  • ridge_kwargs (dict) – Keyword arguments for sklearn.linear_model.Ridge

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.Ridge

Return type:

SklearnModel

sgd_classifier_model(sgd_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.SGDClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.SGDClassifier.html

Parameters:
  • sgd_classifier_kwargs (dict) – Keyword arguments for sklearn.linear_model.SGDClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.SGDClassifier

Return type:

SklearnModel

sgd_one_class_svm_model(sgd_one_class_svm_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.SGDOneClassSVM. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.SGDOneClassSVM.html

Parameters:
  • sgd_one_class_svm_kwargs (dict) – Keyword arguments for sklearn.linear_model.SGDOneClassSVM

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.SGDOneClassSVM

Return type:

SklearnModel

sgd_regressor_model(sgd_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.SGDRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.SGDRegressor.html

Parameters:
  • sgd_regressor_kwargs (dict) – Keyword arguments for sklearn.linear_model.SGDRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.SGDRegressor

Return type:

SklearnModel

stacking_classifier_model(stacking_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.StackingClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.StackingClassifier.html

Parameters:
  • stacking_classifier_kwargs (dict) – Keyword arguments for sklearn.ensemble.StackingClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.StackingClassifier

Return type:

SklearnModel

stacking_regressor_model(stacking_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.StackingRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.StackingRegressor.html

Parameters:
  • stacking_regressor_kwargs (dict) – Keyword arguments for sklearn.ensemble.StackingRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.StackingRegressor

Return type:

SklearnModel

svc_model(svc_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.svm.SVC. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html

Parameters:
  • svc_kwargs (dict) – Keyword arguments for sklearn.svm.SVC

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.svm.SVC

Return type:

SklearnModel

svr_model(svr_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.svm.SVR. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVR.html

Parameters:
  • svr_kwargs (dict) – Keyword arguments for sklearn.svm.SVR

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.svm.SVR

Return type:

SklearnModel

theil_sen_regressor_model(theil_sen_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.TheilSenRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.TheilSenRegressor.html

Parameters:
  • theil_sen_regressor_kwargs (dict) – Keyword arguments for sklearn.linear_model.TheilSenRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.TheilSenRegressor

Return type:

SklearnModel

tweedie_regressor_model(tweedie_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.linear_model.TweedieRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.TweedieRegressor.html

Parameters:
  • tweedie_regressor_kwargs (dict) – Keyword arguments for sklearn.linear_model.TweedieRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.linear_model.TweedieRegressor

Return type:

SklearnModel

voting_classifier_model(voting_classifier_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.VotingClassifier. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.VotingClassifier.html

Parameters:
  • voting_classifier_kwargs (dict) – Keyword arguments for sklearn.ensemble.VotingClassifier

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.VotingClassifier

Return type:

SklearnModel

voting_regressor_model(voting_regressor_kwargs: dict | None = None, sklearn_kwargs: dict | None = None) SklearnModel[source]

DeepMol wrapper for sklearn.ensemble.VotingRegressor. Reference: https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.VotingRegressor.html

Parameters:
  • voting_regressor_kwargs (dict) – Keyword arguments for sklearn.ensemble.VotingRegressor

  • sklearn_kwargs (dict) – Keyword arguments for SklearnModel

Returns:

Wrapped sklearn.ensemble.VotingRegressor

Return type:

SklearnModel

deepmol.models.sklearn_models module

class SklearnModel(model: BaseEstimator, mode: str | None = None, model_dir: str | None = None, **kwargs)[source]

Bases: Model

Wrapper class that wraps scikit-learn models. The SklearnModel class provides a wrapper around scikit-learn models that allows scikit-learn models to be trained on Dataset objects and evaluated with the metrics in Metrics.

cross_validate(dataset: Dataset, metric: Metric, splitter: Splitter | None = None, folds: int = 3)[source]

Performs cross-validation on a dataset.

Parameters:
  • dataset (Dataset) – Dataset to perform cross-validation on.

  • metric (Metric) – Metric to evaluate model performance.

  • splitter (Splitter) – Splitter to use for cross-validation.

  • folds (int) – Number of folds to use for cross-validation.

Returns:

The first element is the best model, the second is the train score of the best model, the third is the train score of the best model, the fourth is the test scores of all models, the fifth is the average train scores of all folds and the sixth is the average test score of all folds.

Return type:

Tuple[SKlearnModel, float, float, List[float], List[float], float, float]

fit_on_batch(dataset: Dataset) None[source]

Fits model on batch of data.

Parameters:

dataset (Dataset) – Dataset to train on.

get_num_tasks() int[source]

Returns the number of tasks.

get_task_type() str[source]

Returns the task type of the model.

classmethod load(folder_path: str, **kwargs) SklearnModel[source]

Loads scikit-learn model from joblib or pickle file on disk. Supported extensions: .joblib, .pkl

Parameters:

folder_path (str) – Path to model file.

Returns:

The loaded scikit-learn model.

Return type:

SklearnModel

property model_type

Returns the type of the model.

predict(dataset: Dataset) ndarray[source]

Makes predictions on dataset.

Parameters:

dataset (Dataset) – Dataset to make prediction on.

Returns:

The value is a return value of predict_proba or predict method of the scikit-learn model. If the scikit-learn model has both methods, the value is always a return value of predict_proba.

Return type:

np.ndarray

predict_on_batch(dataset: Dataset) ndarray[source]

Makes predictions on batch of data.

Parameters:

dataset (Dataset) – Dataset to make prediction on.

Returns:

numpy array of predictions.

Return type:

np.ndarray

predict_proba(dataset: Dataset) ndarray[source]

Makes predictions on dataset.

Parameters:

dataset (Dataset) – Dataset to make prediction on.

Return type:

np.ndarray

save(folder_path: str | None = None)[source]

Saves scikit-learn model to disk using joblib, numpy or pickle. Supported extensions: .joblib, .pkl, .npy

Parameters:

folder_path (str) – Folder path to save model to.

Module contents