ConvexFit.CacheMethod
Cache(A::AbstractMatrix)

Allocate arrays for the solver based on the size of A.

ConvexFit.GridSearchType
GridSearch{TF<:AbstractFloat} <: ModelSelection

Exhaustively assess all parameters on a specified grid. See also grid.

ConvexFit.GridSearchResultType
GridSearchResult{TF<:AbstractFloat} <: ModelSelectionResult

Results from GridSearch, including estimates calculated for each parameter on the grid.

Fields

  • iopt::Int: index of the optimal parameter.
  • loocv::Vector{TF}: leave-one-out cross validation errors.
ConvexFit.OptimSearchType
OptimSearch <: ModelSelection

Search the optimal regularization parameter with a user-specified function. See also optim.

ConvexFit.convexfitFunction
convexfit(A::AbstractMatrix, B::AbstractVecOrMat, λ=0; multithreads=false, kwargs...)

A wrapper method of convexfit that accepts multiple bs in a matrix B and fits each column in B with a convex combination of the columns in matrix A. The actual problems to be solved depend on the type of λ. Results are collected in an array in the order of the columns of B.

Problems across different columns can be solved simultaneously by setting multithreads=true. See also convexfit(::Matrix,::Vector,::Real).

Julia 1.2

Setting multithreads=true requires at least Julia 1.2.

ConvexFit.convexfitFunction
convexfit(A::AbstractMatrix, λ=0; loo=true, multithreads=false, kwargs...)

A wrapper method of convexfit for fitting each column in matrix A with a convex combination of the other columns in matrix A. The actual problems to be solved depend on the type of λ. Results are collected in an array in the order of the columns of B.

By default, with loo=true the fitted column is not involved in the convex combination. This can be altered by setting loo=false. Problems across different columns can be solved simultaneously by setting multithreads=true. See also convexfit(::Matrix,::Vector,::Real).

Julia 1.2

Setting multithreads=true requires at least Julia 1.2.

ConvexFit.convexfitMethod
convexfit(A::Matrix, b::Vector, λs::ModelSelection; looargs, kwargs...)

Select the optimal regularization parameter λ based on leave-one-out cross validation with the method specified with λs and fit vector b with a convex combination of the columns in matrix A. Return a tuple of two objects, the result of fitting b and the result of selecting λ. See also grid, optim and loocv.

All keyword arguments for convexfit(::Matrix,::Vector,::Real) are accepted. Additionally, keyword arguments for loocv can be specified with the keyword looargs and a NamedTuple or Dict.

ConvexFit.convexfitMethod
convexfit(A::Matrix, b::Vector, λ::Real=0; kwargs...)

Fit vector b with a convex combination of the columns in matrix A and an optional regularization parameter λ.

The associated constrained optimization problem can be expressed as follows:

\[\min_x \|Ax - b\|_2^2 + λ\|x\|_2^2 \\ st. x_i ≥ 0 \forall i, \, \sum_i x_i = 1\]

where x is the vector of coefficients to be solved.

Keywords

  • x0::AbstractVector{<:Real}=fill(1/size(A,2),1/size(A,2)): initial value of x.
  • ftol::Real=1e-6: convergence criterion based on the change in the objective function.
  • xtol::Real=1e-6: convergence criterion based on the inf-norm change in x.
  • maxiter::Integer=1000: maximum number of iterations.
  • store_trace::Bool=false: save the solver state in each iteration.
  • show_trace::Bool=false: print the solver state in each iteration to stdout.
  • show_thread::Bool=false: show the thread ID when printing solver states.
  • cache::Cache=Cache(A): Cache that stores intermediate results.
ConvexFit.gridMethod
grid([v])

Specify the grid vector v used for GridSearch. If v is not provided, a default grid is used.

ConvexFit.loocvMethod
loocv(A::Matrix, b::Vector, λ::Real; kwargs...)

Return the leave-one-out cross validation error for fitting vector b with a convex combination of columns in matrix A when the regularization parameter is set to be λ.

The same set of keyword arguments for convexfit(::Matrix,::Vector,::Real) are accepted.

ConvexFit.optimMethod
optim(f::Function)

Specify the function used for searching the optimal regularization parameter. See also OptimSearch.

Function f accepts a univariate objective function associated with the minimization problem to be solved and returns a tuple of two objects, the solver result and the minimizer of the problem. The objective function will be generated by convexfit and passed to f for selecting the optimal regularization parameter.

ConvexFit.@fieldequalMacro
@fieldequal Supertype

Define a method of == for all subtypes of Supertype such that == returns true if each pair of the field values from two instances are equal by ==.