oddt.scoring package

Module contents

oddt.scoring.cross_validate(model, cv_set, cv_target, n=10, shuffle=True, n_jobs=1)[source]

Perform cross validation of model using provided data

Parameters:

model: object

Model to be tested

cv_set: array-like of shape = [n_samples, n_features]

Estimated target values.

cv_target: array-like of shape = [n_samples] or [n_samples, n_outputs]

Estimated target values.

n: integer (default = 10)

How many folds to be created from dataset

shuffle: bool (default = True)

Should data be shuffled before folding.

n_jobs: integer (default = 1)

How many CPUs to use during cross validation

Returns:

r2: array of shape = [n]

R^2 score for each of generated folds

class oddt.scoring.ensemble_descriptor(descriptor_generators)[source]

Bases: object

Proxy class to build an ensemble of destriptors with an API as one

Parameters:

models: array

An array of models

Methods

build(mols, *args, **kwargs)
set_protein(protein)
build(mols, *args, **kwargs)[source]
set_protein(protein)[source]
class oddt.scoring.ensemble_model(models)[source]

Bases: object

Proxy class to build an ensemble of models with an API as one

Parameters:

models: array

An array of models

Methods

fit(X, y, *args, **kwargs)
predict(X, *args, **kwargs)
score(X, y, *args, **kwargs)
fit(X, y, *args, **kwargs)[source]
predict(X, *args, **kwargs)[source]
score(X, y, *args, **kwargs)[source]
class oddt.scoring.scorer(model_instance, descriptor_generator_instance, score_title='score')[source]

Bases: object

Scorer class is parent class for scoring functions.

Parameters:

model_instance: model

Medel compatible with sklearn API (fit, predict and score methods)

descriptor_generator_instance: array of descriptors

Descriptor generator object

score_title: string

Title of score to be used.

Methods

fit(ligands, target, *args, **kwargs) Trains model on supplied ligands and target values
load(filename) Loads scoring function from a pickle file.
predict(ligands, *args, **kwargs) Predicts values (eg.
predict_ligand(ligand) Local method to score one ligand and update it’s scores.
predict_ligands(ligands) Method to score ligands in a lazy fashion.
save(filename) Saves scoring function to a pickle file.
score(ligands, target, *args, **kwargs) Methods estimates the quality of prediction using model’s default
set_protein(protein) Proxy method to update protein in all relevant places.
fit(ligands, target, *args, **kwargs)[source]

Trains model on supplied ligands and target values

Parameters:

ligands: array-like of ligands

Molecules to featurize and feed into the model

target: array-like of shape = [n_samples] or [n_samples, n_outputs]

Ground truth (correct) target values.

classmethod load(filename)[source]

Loads scoring function from a pickle file.

Parameters:

filename: string

Pickle filename

Returns:

sf: scorer-like object

Scoring function object loaded from a pickle

predict(ligands, *args, **kwargs)[source]

Predicts values (eg. affinity) for supplied ligands.

Parameters:

ligands: array-like of ligands

Molecules to featurize and feed into the model

Returns:

predicted: np.array or array of np.arrays of shape = [n_ligands]

Predicted scores for ligands

predict_ligand(ligand)[source]

Local method to score one ligand and update it’s scores.

Parameters:

ligand: oddt.toolkit.Molecule object

Ligand to be scored

Returns:

ligand: oddt.toolkit.Molecule object

Scored ligand with updated scores

predict_ligands(ligands)[source]

Method to score ligands in a lazy fashion.

Parameters:

ligands: iterable of oddt.toolkit.Molecule objects

Ligands to be scored

Returns:

ligand: iterator of oddt.toolkit.Molecule objects

Scored ligands with updated scores

save(filename)[source]

Saves scoring function to a pickle file.

Parameters:

filename: string

Pickle filename

score(ligands, target, *args, **kwargs)[source]

Methods estimates the quality of prediction using model’s default score (accuracy for classification or R^2 for regression)

Parameters:

ligands: array-like of ligands

Molecules to featurize and feed into the model

target: array-like of shape = [n_samples] or [n_samples, n_outputs]

Ground truth (correct) target values.

Returns:

s: float

Quality score (accuracy or R^2) for prediction

set_protein(protein)[source]

Proxy method to update protein in all relevant places.

Parameters:

protein: oddt.toolkit.Molecule object

New default protein