Class LinearModelMSE

Inheritance Relationships

Base Type

Class Documentation

class parpe::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.

Return

Evaluation status

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 reoprt cpuTime consumed by the the function

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.

Return

Evaluation status

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 reoprt cpuTime consumed by the the function

inline virtual int numParameters() const override

Get dimension of function parameter vector.

Return

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