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.VSLeastSquares — TypeVSLeastSquares{Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}The main object to solve a least squares problem.
VectorSpaceLeastSquares.VSLeastSquares — MethodVSLeastSquares(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.
Base.length — Methodlength(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
VectorSpaceLeastSquares.nVariates — MethodnVariates(vslsq::VSLeastSquares{Tb, Tt, Td}) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}Return the number of variates in the least squares problem
Base.size — Methodsize(vslsq::VSLeastSquares{Tb, Tt, Td}) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}Return the tuple (nVariates, length)
VectorSpaceLeastSquares.getCoefficients — MethodgetCoefficients(vslsq::VSLeastSquares{Tb, Tt, Td}) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}Return the coefficients solution to the least squares problem.
VectorSpaceLeastSquares.getBasis — MethodgetBasis(vslsq::VSLeastSquares{Tb, Tt, Td}) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}Return the basis used to solve the least squares problem.
An instance of VSLeastSquares is typically manipulated using the following methods to solve the least squares problem and compute a prediction
VectorSpaceLeastSquares.fit — Methodfit(vslsq::VSLeastSquares{Tb, Tt, Td}, x::AbstractVector{<:AbstractVector{Td}}, y::AbstractVector{Td}) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}Solve the least squares problem.
VectorSpaceLeastSquares.predict — Methodpredict(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.
If the underlying basis of type Tb is differentiable the derivative of the prediction can be computed using
VectorSpaceLeastSquares.derivative — Methodderivative(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.
VectorSpaceLeastSquares.gradient — Methodgradient(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.