Pruning Options
Pruning is simply done by a method which takes in three arguments. They are the full vector of weights to update, w
, a collection of indexable kernel vectors, kvecs
, and the set of indicies from the KernelDowndater
, inds
. The kernel vectors will each have the same length as inds
, while w
will have to be indexed by inds
. The pruning method will then choose a single or a linear combination of the kernel vectors to prune with, and update the weights vector, w
. For each kernel vector, there will typically be two choices of scalars to add to the weights to maintain nonnegativity. These can be computed by the get_alpha_k0s
method.
CaratheodoryPruning.get_alpha_k0s
— Functionget_alpha_k0s(w, kvec, inds)
Helper method that, given a vector of weights, w
, a kernel vector kvec
, and a vector of indices, inds
, returns a 4-tuple, (alphan, k0n, alphap, k0p)
used for pruning. alphan
is the most negative multiple allowed such that w = w + alphan * kvec
still has nonnegative entries, and equals zero at k0n
. Similarly, alphap
is the most positive multiple allowed such that w = w + alphap * kvec
still has nonnegative entries, and equals zero at k0p
.
CaratheodoryPruning.jl
comes with several built-in pruning options. They can be easily used by calling caratheodory_pruning(V, w_in, pruning=PRUNING)
, replacing PRUNING
with the appropriate method.
Prune first
Prunes using the first kernel vector in kvecs
.
CaratheodoryPruning.prune_weights_first!
— Functionprune_weights_first!(w, kvecs, inds)
Takes in a vector of full-length weights, w
, a vector of kernel vectors, kvecs
, and a vector of indices, inds
, to which the indices of the kernel vectors point in the weights.
Takes the first kernel vector, and prunes with that, using the minimum absolute value multiple needed to zero one of the weights.
Prune Minimum Absolute Value
Prunes according to the kernel vector in kvecs
which results in the minimum absolute value multiple added.
CaratheodoryPruning.prune_weights_minabs!
— Functionprune_weights_minabs!(w, kvecs, inds)
Takes in a vector of full-length weights, w
, a vector of kernel vectors, kvecs
, and a vector of indices, inds
, to which the indices of the kernel vectors point in the weights.
Loops over all kernel vectors, and prunes with the vector with the minimum absolute value multiple needed to zero one of the weights.