![]() |
slope 0.31.0
|
The Multinomial class represents a multinomial logistic regression loss function. More...
#include <multinomial.h>


Public Member Functions | |
| double | loss (const Eigen::MatrixXd &eta, const Eigen::MatrixXd &y) |
| Calculates the loss for the multinomial loss function. | |
| double | dual (const Eigen::MatrixXd &theta, const Eigen::MatrixXd &y, const Eigen::VectorXd &w) |
| Calculates the dual for the multinomial loss function. | |
| Eigen::MatrixXd | residual (const Eigen::MatrixXd &eta, const Eigen::MatrixXd &y) |
| Calculates the residual for the multinomial loss function. | |
| Eigen::MatrixXd | preprocessResponse (const Eigen::MatrixXd &y) |
| Preprocesses the response for the Multinomial model. | |
| void | updateWeightsAndWorkingResponse (Eigen::VectorXd &w, Eigen::VectorXd &z, const Eigen::VectorXd &eta, const Eigen::VectorXd &y) |
| Updates the weights and working response for the multinomial loss function. Currently not implemented since there is no coordinate descent solver for the multinomial logistic regression loss. | |
| Eigen::MatrixXd | link (const Eigen::MatrixXd &mu) |
| The link function. | |
| Eigen::MatrixXd | inverseLink (const Eigen::MatrixXd &eta) |
| The inverse link function, also known as the mean function. | |
| Eigen::MatrixXd | predict (const Eigen::MatrixXd &eta) |
| Return predicted response, which is an integer class label based on the predicted probabilities. | |
Public Member Functions inherited from slope::Loss | |
| virtual | ~Loss ()=default |
| Destructor for the Loss class. | |
| virtual void | updateIntercept (Eigen::VectorXd &beta0, const Eigen::MatrixXd &eta, const Eigen::MatrixXd &y) |
| Updates the intercept with a gradient descent update. Also updates the linear predictor (but not the residual). | |
| virtual double | deviance (const Eigen::MatrixXd &eta, const Eigen::MatrixXd &y) |
| Computes deviance, which is 2 times the difference between the loglikelihood of the model and the loglikelihood of the null (intercept-only) model. | |
Additional Inherited Members | |
Protected Member Functions inherited from slope::Loss | |
| Loss (double lipschitz_constant) | |
| Constructs an loss function with specified Lipschitz constant. | |
The Multinomial class represents a multinomial logistic regression loss function.
The multinomial loss function is used for multi-class classification problems. It calculates the loss, dual, residual, and updates weights and working response. Assumes the response y is a one-hot encoded matrix where each row sums to 1.
Definition at line 20 of file multinomial.h.
|
inlineexplicit |
Definition at line 23 of file multinomial.h.
|
virtual |
Calculates the dual for the multinomial loss function.
| theta | The dual variables (n x k matrix). |
| y | The true labels (n x k matrix of one-hot encoded class memberships). |
| w | The weights vector. |
Implements slope::Loss.
Definition at line 24 of file multinomial.cpp.
|
virtual |
The inverse link function, also known as the mean function.
| eta |
Implements slope::Loss.
Definition at line 106 of file multinomial.cpp.
|
virtual |
The link function.
| mu | Mean. |
Implements slope::Loss.
Definition at line 98 of file multinomial.cpp.
|
virtual |
Calculates the loss for the multinomial loss function.
| eta | The predicted values (n x k matrix of linear predictors). |
| y | The true labels (n x k matrix of one-hot encoded class memberships). |
Implements slope::Loss.
Definition at line 10 of file multinomial.cpp.
|
virtual |
Return predicted response, which is an integer class label based on the predicted probabilities.
| eta | The linear predictor |
Implements slope::Loss.
Definition at line 112 of file multinomial.cpp.
|
virtual |
Preprocesses the response for the Multinomial model.
| y | Predicted values vector (n x 1) of integer class labels |
Implements slope::Loss.
Definition at line 40 of file multinomial.cpp.
|
virtual |
Calculates the residual for the multinomial loss function.
| eta | The predicted values (n x k matrix of linear predictors). |
| y | The true labels (n x k matrix of one-hot encoded class memberships). |
Implements slope::Loss.
Definition at line 34 of file multinomial.cpp.
|
virtual |
Updates the weights and working response for the multinomial loss function. Currently not implemented since there is no coordinate descent solver for the multinomial logistic regression loss.
| w | The weights vector. |
| z | The working response vector. |
| eta | The predicted values (n x k matrix of linear predictors). |
| y | The true labels (n x k matrix of one-hot encoded class memberships). |
Implements slope::Loss.
Definition at line 89 of file multinomial.cpp.