qsprpred.models.assessment package

Subpackages

Submodules

qsprpred.models.assessment.classification module

qsprpred.models.assessment.classification.create_metrics_summary(model, assessments)[source]

qsprpred.models.assessment.methods module

This module holds assessment methods for QSPRModels

class qsprpred.models.assessment.methods.Assessor(name: str, scoring: str | Callable[[Iterable, Iterable], float], split: DataSplit, monitor: AssessorMonitor | None = None, use_proba: bool = True, mode: EarlyStoppingMode | None = None, round: int = 5, split_multitask_scores: bool = False)[source]

Bases: ModelAssessor

Perform cross validation on a model.

Variables:
  • useProba (bool) – use predictProba instead of predict for classification

  • monitor (AssessorMonitor) – monitor to use for assessment, if None, a BaseMonitor is used

  • mode (EarlyStoppingMode) – mode to use for early stopping

  • split (DataSplit) – split to use for cross validation (default: KFold, n_splits=5)

  • round (int) – number of decimal places to round predictions to (default: 5)

  • splitMultitaskScores (bool) – whether to split the scores per task for multitask models

Initialize the evaluation method class.

Parameters:
  • name (str) – name of the evaluation method

  • scoring – str | Callable[[Iterable, Iterable], float],

  • monitor (AssessorMonitor) – monitor to track the evaluation

  • use_proba (bool) – use probabilities for classification models

  • mode (EarlyStoppingMode) – early stopping mode for fitting

  • split_multitask_scores (bool) – whether to split the scores per task for multitask models

predictionsToDataFrame(model: QSPRModel, y_train: ndarray, y_test: ndarray, train_preds: ndarray | list[ndarray], test_preds: ndarray | list[ndarray], fold: int) DataFrame

Create a dataframe with true values and predictions.

Parameters:
  • model (QSPRModel) – model to evaluate.

  • dataset (QSPRDataSet) – dataset to evaluate on.

  • y_train (np.ndarray) – training target values.

  • y_test (np.ndarray) – testing target values.

  • train_preds (np.ndarray | list[np.ndarray]) – training predictions.

  • test_preds (np.ndarray | list[np.ndarray]) – testing predictions.

  • fold (int) – current fold number.

Returns:

dataframe with true values and predictions.

Return type:

pd.DataFrame

class qsprpred.models.assessment.methods.ModelAssessor(name: str, scoring: str | Callable[[Iterable, Iterable], float], monitor: AssessorMonitor | None = None, use_proba: bool = True, mode: EarlyStoppingMode | None = None, split_multitask_scores: bool = False)[source]

Bases: ABC

Base class for assessment methods.

Variables:
  • name (str) – name of the assessment method

  • scoreFunc (Metric) – scoring function to use, should match the output of the evaluation method (e.g. if the evaluation methods returns class probabilities, the scoring function support class probabilities)

  • monitor (AssessorMonitor) – monitor to use for assessment, if None, a BaseMonitor is used

  • useProba (bool) – wheter to use probabilities for classification models

  • mode (EarlyStoppingMode) – early stopping mode for fitting

  • splitMultitaskScores (bool) – whether to split the scores per task for multitask models

  • scores (np.ndarray) – Scores returned by the scoring function for each fold

  • predictions (pd.Dataframe) – Predictions returned by the model for each fold

Initialize the evaluation method class.

Parameters:
  • name (str) – name of the evaluation method

  • scoring – str | Callable[[Iterable, Iterable], float],

  • monitor (AssessorMonitor) – monitor to track the evaluation

  • use_proba (bool) – use probabilities for classification models

  • mode (EarlyStoppingMode) – early stopping mode for fitting

  • split_multitask_scores (bool) – whether to split the scores per task for multitask models

predictionsToDataFrame(model: QSPRModel, y_train: ndarray, y_test: ndarray, train_preds: ndarray | list[ndarray], test_preds: ndarray | list[ndarray], fold: int) DataFrame[source]

Create a dataframe with true values and predictions.

Parameters:
  • model (QSPRModel) – model to evaluate.

  • dataset (QSPRDataSet) – dataset to evaluate on.

  • y_train (np.ndarray) – training target values.

  • y_test (np.ndarray) – testing target values.

  • train_preds (np.ndarray | list[np.ndarray]) – training predictions.

  • test_preds (np.ndarray | list[np.ndarray]) – testing predictions.

  • fold (int) – current fold number.

Returns:

dataframe with true values and predictions.

Return type:

pd.DataFrame

qsprpred.models.assessment.regression module

qsprpred.models.assessment.regression.create_correlation_summary(model, assessments)[source]

Module contents