deepmol.metrics package
Submodules
deepmol.metrics.metrics module
- class Metric(metric: callable, task_averager: callable | None = None, name: str | None = None, **kwargs)[source]
Bases:
object
Class for computing machine learning metrics.
Metrics can be imported from scikit-learn or can be user defined functions.
- compute_metric(y_true: ndarray, y_pred: ndarray, n_tasks: int, per_task_metrics: bool = False) Tuple[Any, List[Any]] [source]
Compute a performance metric for each task.
- Parameters:
y_true (np.ndarray) – An np.ndarray containing true values for each task.
y_pred (np.ndarray) – An np.ndarray containing predicted values for each task.
n_tasks (int) – The number of tasks this class is expected to handle.
per_task_metrics (bool) – If true, return computed metric for each task on multitask dataset.
kwargs (dict) – Will be passed on to self.metric
- Returns:
Tuple with the task averager computed value and a list containing metric values for each task.
- Return type:
Tuple[Any, List[Any]]
- compute_singletask_metric(y_true: ndarray, y_pred: ndarray, **kwargs) float [source]
Compute a metric value for a singletask problem.
- Parameters:
y_true (np.ndarray) – True values array.
y_pred (np.ndarray) – Predictions array.
kwargs (dict) – Will be passed on to self.metric
- Returns:
metric_value – The computed value of the metric.
- Return type:
float
deepmol.metrics.metrics_functions module
Script containing imports of metrics and new metric functions.