Least squares problem

Solving a least squares problem of the form

\[\inf_{\alpha \in \mathbb{R}^d} \sum_{m=1}^M \left(\sum_{i=1}^d \alpha_i g_i\circ\varphi(x_m) - y_m\right)^2\]

is done by creating an instance of VSLeastSquares

VectorSpaceLeastSquares.VSLeastSquaresMethod
VSLeastSquares(basis::Tb, transform::Tt=VoidTransformation(), Td::Type=Float64) where {Tb<:AbstractBasis, Tt<:AbstractTransformation}

Create a VSLeastSquares object from basis and transform and capable of handling Td typed data.

source
Base.lengthMethod
length(vslsq::VSLeastSquares{Tb, Tt, Td}) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}

Return the number of functions of the basis used to solve the least squares problem

source
VectorSpaceLeastSquares.nVariatesMethod
nVariates(vslsq::VSLeastSquares{Tb, Tt, Td}) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}

Return the number of variates in the least squares problem

source
Base.sizeMethod
size(vslsq::VSLeastSquares{Tb, Tt, Td}) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}

Return the tuple (nVariates, length)

source
VectorSpaceLeastSquares.getCoefficientsMethod
getCoefficients(vslsq::VSLeastSquares{Tb, Tt, Td}) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}

Return the coefficients solution to the least squares problem.

source
VectorSpaceLeastSquares.getBasisMethod
getBasis(vslsq::VSLeastSquares{Tb, Tt, Td}) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}

Return the basis used to solve the least squares problem.

source

An instance of VSLeastSquares is typically manipulated using the following methods to solve the least squares problem and compute a prediction

VectorSpaceLeastSquares.fitMethod
fit(vslsq::VSLeastSquares{Tb, Tt, Td}, x::AbstractVector{<:AbstractVector{Td}}, y::AbstractVector{Td}) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}

Solve the least squares problem.

source
VectorSpaceLeastSquares.predictMethod
predict(vslsq::VSLeastSquares{Tb, Tt, Td}, x::AbstractVector{Td}) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}

Compute the value predicted by the least squares problem.

The method fit must have been called before.

source

If the underlying basis of type Tb is differentiable the derivative of the prediction can be computed using

VectorSpaceLeastSquares.derivativeMethod
derivative(vslsq::VSLeastSquares{Tb, Tt, Td}, x::AbstractVector{Td}, index::Integer) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}

Compute the partial derivative of the prediction w.r.t to the index variable.

The method fit must have been called before.

source
VectorSpaceLeastSquares.gradientMethod
gradient(vslsq::VSLeastSquares{Tb, Tt, Td}, x::AbstractVector{Td}) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}

Compute the gradient of the prediction at x.

The method fit must have been called before.

source