paddlets.metrics.metrics

class MSE(mode: str = 'normal')[source]

Bases: Metric

Mean Squared Error.

Parameters

mode (str) – Supported metric modes, only normal and prob are valid values. Set to normal for non-probability use cases, set to prob for probability use cases. Note that mode = prob is currently not supported.

_NAME

Metric name.

Type

str

_MAXIMIZE

Identify optimization direction.

Type

bool

metric_fn(y_true: ndarray, y_score: ndarray) float[source]

Mean squared error regression loss.

Parameters
  • y_true (np.ndarray) – Ground truth (correct) target values.

  • y_score (np.ndarray) – Estimated target values.

Returns

Mean squared error regression loss. A non-negative floating point value (the best value is 0.0).

Return type

float

class MAE(mode: str = 'normal')[source]

Bases: Metric

Mean Absolute Error.

Parameters

mode (str) – Supported metric modes, only normal and prob are valid values. Set to normal for non-probability use cases, set to prob for probability use cases. Note that mode = prob is currently not supported.

_NAME

Metric name.

Type

str

_MAXIMIZE

Identify optimization direction.

Type

bool

metric_fn(y_true: ndarray, y_score: ndarray) float[source]

Mean absolute error regression loss.

Parameters
  • y_true (np.ndarray) – Ground truth (correct) target values.

  • y_score (np.ndarray) – Estimated target values.

Returns

Mean absolute error regression loss. A non-negative floating point value (the best value is 0.0).

Return type

float

class LogLoss(mode: str = 'normal')[source]

Bases: Metric

Log loss or cross-entropy loss.

Parameters

mode (str) – Supported metric modes, only normal and prob are valid values. Set to normal for non-probability use cases, set to prob for probability use cases. Note that mode = prob is currently not supported.

_NAME

Metric name.

Type

str

_MAXIMIZE

Identify optimization direction.

Type

bool

metric_fn(y_true: ndarray, y_score: ndarray) float[source]

Log loss or cross-entropy loss.

Parameters
  • y_true (np.ndarray) – Ground truth (correct) labels.

  • y_score (np.ndarray) – Predicted probabilities.

Returns

Log loss or cross-entropy loss.

Return type

float

class MetricContainer(metric_names: List[str], prefix: str = '')[source]

Bases: object

Container holding a list of metrics.

Parameters
  • metric_names (List[str]) – List of metric names.

  • prefix (str) – Prefix of metric names.

_prefix

Prefix of metric names.

Type

str

_metrics

List of metric instance.

Type

List[Metric]

_names

List of metric names associated with eval_name.

Type

List[str]