VectorSpaceLeastSquares.AbstractTransformationType
AbstractTransformation

Super type for all transformations.

A transformation is a function $\varphi: \mathbb{R}^d \to \mathbb{R}^d$, which is applied on the fly to the data before proceeding with the least squares problem. A transformation must implement apply! and jacobian.

To define a new transformation, define a new concrete subtype of AbstractTransformation and implement the corresponding apply! and jacobian methods. For instance the scaled log-transformation $\varphi(x) = \alpha \log(x)$ where $\alpha \in \mathbb{R}$ is defined as follows

struct LogTransformation <: AbstractTransformation
    scale::Vector{<:Real}
end

function apply!(t::LogTransformation, tx::AbstractVector{Td}, x::AbstractVector{Td}) where Td<:Real
    tx .= t.scale .* log.(x)
end

function jacobian(t::LogTransformation, x::AbstractVector{<:Real}, i::Integer, j::Integer)
    if i != j
        return 0.
    end
    t.scale[i] / x[i]
end
source
VectorSpaceLeastSquares.GaussianTransformationMethod
GaussianTransformation(x::AbstractVector{<:AbstractVector{T}}) where T<:Real

Create a Gaussian transformation by setting α as the empirical mean and σ as the empirical standard deviation. Each entry of x is supposed to be one sample of the data.

source
VectorSpaceLeastSquares.GaussianTransformationType
GaussianTransformation{Td} <: AbstractTransformation where Td<:Real

Implement an Gaussian transformation of the data defined by $\varphi(x) = N((x - \alpha) / \sigma)$ where $N$ is the cdf of the standard Gaussian distribution

source
VectorSpaceLeastSquares.LinearTransformationMethod
LinearTransformation(x::AbstractVector{<:AbstractVector{T}}) where T<:Real

Create a linear transformation by setting α as the empirical mean and σ as the inverse of the empirical standard deviation. Each entry of x is supposed to be one sample of the data.

source
VectorSpaceLeastSquares.LogNormalTransformationMethod
LogNormalTransformation(x::AbstractVector{<:AbstractVector{T}}) where T<:Real

Create a Log-normal transformation by setting α and σ as the empirical mean and variance of log(x) . Each entry of x is supposed to be one sample of the data.

source
VectorSpaceLeastSquares.LogNormalTransformationType
LogNormalTransformation{Td} <: AbstractTransformation where Td<:Real

Implement a Log-normal transformation of the data defined by $\varphi(x) = N((\log(x) - \alpha) / \sigma)$ where $N$ is the cdf of the standard Gaussian distribution.

source
VectorSpaceLeastSquares.PiecewiseConstantBasisMethod
PiecewiseConstantBasis(nVariates::Integer, nIntervals::Vector{<:Integer})

Create a PiecewiseConstantBasis by specifying the number of intervals per direction (possibly different to allow non squared grids).

source
VectorSpaceLeastSquares.PiecewiseConstantBasisType
PiecewiseConstantBasis

Represent a basis of local functions defined on $[0,1]^d$

  • nVariates is the dimension d of the space.
  • nIntervals is a vector of size d defining the number of sub-intervals to use along each dimension
source
VectorSpaceLeastSquares.PolynomialBasisType
PolynomialBasis

Represent a multivariate polynomial

  • degree::Int64: maximum total degree
  • nVariates::Int6: number of variates
  • dim::Int6: dimension of the generated vector space
  • type::PolynomialType: a value from PolynomialType
  • tensor::SparseMatrixCSC{Int64, Int64}: the sparse tensor representation of the polynomial. Polynomials are stored by column.
source
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(b::AbstractBasis)

Return the number of elements in the basis.

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
Base.sizeMethod
size(vslsq::VSLeastSquares{Tb, Tt, Td}) where {Tb<:AbstractBasis, Tt<:AbstractTransformation, Td<:Real}

Return the tuple (nVariates, length)

source
VectorSpaceLeastSquares.apply!Method
apply!(t::AbstractTransformation, tx::AbstractVector{Td}, x::AbstractVector{Td}) where Td<:Real

Apply the transformation t to x and store the result in tx.

source
VectorSpaceLeastSquares.derivativeMethod
derivative(b::AbstractBasis, x::AbstractVector{<:Real}, index::Integer, derivativeIndex::Integer)

Compute the value of the first derivative of the index-th basis function w.r.t to the derivativeIndex variate at point x.

source
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.derivativeMethod
derivative(p::PolynomialBasis, x::AbstractVector{Td}, polIndex::Ti, derivativeIndex::Ti) where {Td<:Real, Ti<:Integer}

Evaluate the first partial derivative w.r.t variable derivativeIndex of the polIndex-th member of the polynomial basis p

source
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.fitMethod
fit(vslsq::VSLeastSquares{PiecewiseConstantBasis, Tt, Td}, x::AbstractVector{<:AbstractVector{Td}}, y::AbstractVector{Td}) where {Tt<:AbstractTransformation, Td<:Real}

Solve the least squares problem using the specific structure of the PiecewiseConstantBasis.

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
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.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
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
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
VectorSpaceLeastSquares.predictMethod
predict(vslsq::VSLeastSquares{PiecewiseConstantBasis, Tt, Td}, x::AbstractVector{Td}) where {Tt<:AbstractTransformation, Td<:Real}

Compute the value predicted by the least squares problem using the specific structure of the PiecewiseConstantBasis.

The method fit must have been called before.

source