Algorithm-SVMLight
view release on metacpan or search on metacpan
lib/Algorithm/SVMLight.pm view on Meta::CPAN
which features are having the greatest impact on decision-making.
my $arrayref = $m->get_linear_weights();
The first element (position 0) of the array will be the threshold
C<b>, and the rest of the elements will be the weights themselves.
Thus from 1 upward, the indices align with SVMLight's internal
indices.
If the model has not yet been trained, or if the kernel type is not
linear, an exception will be thrown.
=item feature_names()
Returns a list of feature names that have been fed to
C<add_instance()> as keys of the C<attribute> parameter, or in a
scalar context the number of such names.
=item num_features()
Returns the number of features known to this model. Note that if you
lib/Algorithm/SVMLight.xs view on Meta::CPAN
double *labels;
} corpus;
double ranking_callback(DOC **docs, double *rankvalue, long i, long j, LEARN_PARM *learn_parm) {
dSP;
SV *callback = (SV *) learn_parm->costfunccustom;
int count;
double result;
/* Don't bother checking the type of 'callback' - it could be a CODE
* reference or a string, and perl will throw its own error otherwise.
*/
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVnv(rankvalue[i])));
XPUSHs(sv_2mortal(newSVnv(rankvalue[j])));
XPUSHs(sv_2mortal(newSVnv(docs[i]->costfactor)));
XPUSHs(sv_2mortal(newSVnv(docs[j]->costfactor)));
( run in 0.379 second using v1.01-cache-2.11-cpan-496ff517765 )