GitHub
deepbox/metrics

Regression Metrics

Point-error, scale-aware, and variance-based regression metrics for model evaluation.
Regression
adjustedR2Score
export declare function adjustedR2Score(yTrue: Tensor, yPred: Tensor, nFeatures: number): number;

Calculate Adjusted R² score.

explainedVarianceScore
export declare function explainedVarianceScore(yTrue: Tensor, yPred: Tensor): number;

Calculate explained variance score.

mae
export declare function mae(yTrue: Tensor, yPred: Tensor): number;

Calculate Mean Absolute Error (MAE).

mape
export declare function mape(yTrue: Tensor, yPred: Tensor): number;

Calculate Mean Absolute Percentage Error (MAPE).

maxError
export declare function maxError(yTrue: Tensor, yPred: Tensor): number;

Calculate maximum residual error.

medianAbsoluteError
export declare function medianAbsoluteError(yTrue: Tensor, yPred: Tensor): number;

Calculate Median Absolute Error (MedAE).

mse
export declare function mse(yTrue: Tensor, yPred: Tensor): number;

Calculate Mean Squared Error (MSE).

r2Score
export declare function r2Score(yTrue: Tensor, yPred: Tensor): number;

Calculate R² (coefficient of determination) score.

rmse
export declare function rmse(yTrue: Tensor, yPred: Tensor): number;

Calculate Root Mean Squared Error (RMSE).

metrics-regression.ts
import { mae, mape, mse, r2Score, rmse } from "deepbox/metrics";import { tensor } from "deepbox/ndarray";const yTrue = tensor([3, 5, 2.5, 7]);const yPred = tensor([2.8, 4.9, 2.0, 7.4]);console.log(mse(yTrue, yPred));console.log(rmse(yTrue, yPred));console.log(mae(yTrue, yPred));console.log(mape(yTrue, yPred));console.log(r2Score(yTrue, yPred));