GenSVM
|
This page explains the translation from the mathematics in the paper for computing the and
values, to the implementation in the code. It is here mostly for future reference and documentation purposes, you won't actually need to understand this in order to use GenSVM.
We start our analysis with the computation of the :
Since in the code in gensvm_get_Avalue_update_B() we work with a condition on the , we will write the
using this condition as well:
Now, if , we need to calculate the
, corresponding to
. From the overview of quadratic majorization coefficients given in the paper, we see that there are five regions for the coefficient depending on the value of
and
. However, with
, this reduces to three regions, since
if
. Plugging in
in the formulas from the table yields the following expressions for
:
These coefficients should correspond to the coefficients for as calculated in gensvm_calculate_ab_simple().
If , we need to calculate
. Here, we distinguish two cases depending on the value of
. If
, the value of
is the same everywhere, and equal to 1.5. Otherwise, if
, we have
Note that in the second case the expression is independent of , so this value can be cached. These expressions for
are reflected in gensvm_calculate_ab_non_simple().
We continue the analysis with the computation of the vectors. These vectors are given by the expression:
Similarly to the above, we can write this in two cases depending on
:
In the code we directly compute the differences of the form , since this is saves some computations. We therefore work out the values of these expressions below.
First, for we have, after plugging in
and rearranging:
(the final 0 may be surprising, but can be found when plugging in the value of ). The above coefficients for this difference are reflected in gensvm_calculate_ab_simple().
Now for , we first have the case where
, then
Second, we have the case where , in that case:
These coefficients are all calculated in gensvm_calculate_ab_non_simple().