Class LinearModelMSE

Inheritance Relationships

Base Type

Class Documentation

class LinearModelMSE : public parpe::SummedGradientFunction<int>

The LinearModelMSE class is a wrapper around LinearModel implementing the mean squared error loss function.

Public Functions

inline explicit LinearModelMSE(int numParameters)
inline virtual FunctionEvaluationStatus evaluate(gsl::span<const double> parameters, int dataset, double &fval, gsl::span<double> gradient, Logger *logger, double *cpuTime) const override

Evaluate on single data point.

Parameters:
  • parameters – Parameter vector where the function is to be evaluated

  • dataset – The dataset on which to evaluate the function

  • fval – Output argument for f(x)

  • gradient – Preallocated space for the gradient of size dim(parameters). Or gsl::span<double>() for evaluation without gradient.

  • logger – Optional Logger instance used for output

  • cputime – Optional output argument to report cpuTime consumed by the the function

Returns:

Evaluation status

virtual FunctionEvaluationStatus evaluate(gsl::span<const double> parameters, std::vector<int> dataIndices, double &fval, gsl::span<double> gradient, Logger *logger, double *cpuTime) const override

Evaluate on vector of data points.

Parameters:
  • parameters – Parameter vector where the function is to be evaluated

  • datasets – The datasets on which to evaluate the function

  • fval – Output argument for f(x)

  • gradient – Preallocated space for the gradient of size dim(parameters). Or gsl::span<double>() for evaluation without gradient.

  • logger – Optional Logger instance used for output

  • cputime – Optional output argument to report cpuTime consumed by the the function

Returns:

Evaluation status

inline virtual int numParameters() const override

Get dimension of function parameter vector.

Returns:

Number of parameters

inline virtual std::vector<std::string> getParameterIds() const override

Public Members

int numParameters_ = 0
std::vector<std::vector<double>> datasets
std::vector<double> labels
LinearModel lm