slope 6.6.0
Loading...
Searching...
No Matches
slope::MSE Class Reference

Mean Squared Error (MSE) scoring metric. More...

#include <score.h>

Inheritance diagram for slope::MSE:
Collaboration diagram for slope::MSE:

Public Member Functions

double eval (const Eigen::MatrixXd &eta, const Eigen::MatrixXd &y, const std::unique_ptr< Loss > &) const override
double eval (const Eigen::MatrixXd &eta, const Eigen::MatrixXd &y, const std::unique_ptr< Loss > &loss, const Eigen::VectorXd &observation_weights) const override
Public Member Functions inherited from slope::MinimizeScore
bool isWorse (double a, double b) const override
double initValue () const override
Public Member Functions inherited from slope::Score
std::function< bool(double, double)> getComparator () const

Additional Inherited Members

Static Public Member Functions inherited from slope::Score
static std::unique_ptr< Score > create (const std::string &metric)

Detailed Description

Mean Squared Error (MSE) scoring metric.

Computes the average squared difference between predictions and true responses. Inherits from MinimizeScore since lower MSE values indicate better fit.

MSE = (1/n) Σ(y_i - η_i)² where:

  • n is the number of samples
  • y_i is the true response for sample i
  • η_i is the predicted response for sample i

Definition at line 183 of file score.h.

Member Function Documentation

◆ eval() [1/2]

double slope::MSE::eval ( const Eigen::MatrixXd & eta,
const Eigen::MatrixXd & y,
const std::unique_ptr< Loss > &  ) const
overridevirtual

Evaluates the MSE between predictions and true responses.

Parameters
etaMatrix of model predictions
yMatrix of true responses
Returns
Computed MSE value

Implements slope::Score.

◆ eval() [2/2]

double slope::MSE::eval ( const Eigen::MatrixXd & eta,
const Eigen::MatrixXd & y,
const std::unique_ptr< Loss > & loss,
const Eigen::VectorXd & observation_weights ) const
overridevirtual

Evaluates the metric with observation weights. Empty weights select the unweighted metric. Weights must be finite and nonnegative, and their sum must be positive. Multiplying every weight by a positive constant leaves the score unchanged. Custom metrics can override this overload; the default implementation accepts uniform weights only.

Reimplemented from slope::Score.


The documentation for this class was generated from the following file: