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

Deviance scoring metric. More...

#include <score.h>

Inheritance diagram for slope::Deviance:
Collaboration diagram for slope::Deviance:

Public Member Functions

double eval (const Eigen::MatrixXd &eta, const Eigen::MatrixXd &y, const std::unique_ptr< Loss > &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

Deviance scoring metric.

Computes the statistical deviance, which is -2 times the log-likelihood of the predictions under the specified loss function. Inherits from MinimizeScore since lower deviance indicates better model fit.

Deviance = 2 * ( log L(saturated) - log L (fitted) )

The exact form of deviance depends on the loss function used.

Definition at line 316 of file score.h.

Member Function Documentation

◆ eval() [1/2]

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

Evaluates the deviance between predictions and true responses.

Parameters
etaMatrix of model predictions
yMatrix of true responses
lossLoss function that defines the likelihood
Returns
Computed deviance value

Implements slope::Score.

◆ eval() [2/2]

double slope::Deviance::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: