qxmt.evaluation.metrics.defaults_regression module#
- class qxmt.evaluation.metrics.defaults_regression.MeanAbsoluteError(name='mean_absolute_error')#
Bases:
BaseMetric
Mean absolute error metric class.
- Parameters:
BaseMetric (_type_) – Base metric class
name (str)
Examples
>>> import numpy as np >>> from qxmt.evaluation.defaults import MeanAbsoluteError >>> metric = MeanAbsoluteError() >>> metric.set_score(np.array([1, 0, 1]), np.array([1, 1, 1])) >>> metric.output_score() mean_absolute_error: 0.33
- __init__(name='mean_absolute_error')#
Initialize the mean absolute error metric.
- Parameters:
name (str, optional) – name of mean absolute error metric. Defaults to “mean_absolute_error”.
- Return type:
None
- static evaluate(actual, predicted, **kwargs)#
Evaluate the mean absolute error.
- Parameters:
actual (np.ndarray) – numpy array of actual values
predicted (np.ndarray) – numpy array of predicted values
kwargs (Any)
- Returns:
mean absolute error score
- Return type:
float
- class qxmt.evaluation.metrics.defaults_regression.R2Score(name='r2_score')#
Bases:
BaseMetric
R2 score metric class.
- Parameters:
BaseMetric (_type_) – Base metric class
name (str)
Examples
>>> import numpy as np >>> from qxmt.evaluation.defaults import R2Score >>> metric = R2Score() >>> metric.set_score(np.array([1, 0, 1]), np.array([1, 1, 1])) >>> metric.output_score() r2_score: -0.5
- __init__(name='r2_score')#
Initialize the R2 score metric.
- Parameters:
name (str, optional) – name of R2 score metric. Defaults to “r2_score”.
- Return type:
None
- static evaluate(actual, predicted, **kwargs)#
Evaluate the R2 score.
- Parameters:
actual (np.ndarray) – numpy array of actual values
predicted (np.ndarray) – numpy array of predicted values
kwargs (Any)
- Returns:
R2 score
- Return type:
float
- class qxmt.evaluation.metrics.defaults_regression.RootMeanSquaredError(name='root_mean_squared_error')#
Bases:
BaseMetric
Root mean squared error metric class.
- Parameters:
BaseMetric (_type_) – Base metric class
name (str)
Examples
>>> import numpy as np >>> from qxmt.evaluation.defaults import RootMeanSquaredError >>> metric = RootMeanSquaredError() >>> metric.set_score(np.array([1, 0, 1]), np.array([1, 1, 1])) >>> metric.output_score() root_mean_squared_error: 0.58
- __init__(name='root_mean_squared_error')#
Initialize the root mean squared error metric.
- Parameters:
name (str, optional) – name of root mean squared error metric. Defaults to “root_mean_squared_error”.
- Return type:
None
- static evaluate(actual, predicted, **kwargs)#
Evaluate the root mean squared error.
- Parameters:
actual (np.ndarray) – numpy array of actual values
predicted (np.ndarray) – numpy array of predicted values
kwargs (Any)
- Returns:
root mean squared error score
- Return type:
float