Algorithm-LibLinear
view release on metacpan or search on metacpan
Deprecated. Use C<find_parameters> instead.
Shorthand alias for C<find_parameters> only works on C<cost> parameter.
Notice that C<loss_sensitivity> is affected too when C<update> is set.
=head2 find_parameters(data_set => $data_set, num_folds => $num_folds [, initial_cost => -1.0] [, initial_loss_sensitivity => -1.0] [, update => 0])
Finds the best parameters by N-fold cross validation. If C<initial_cost> or C<initial_loss_sensitivity> is a negative, the value is automatically calculated.
Works only for 3 solvers: C<'L2R_LR'>, C<'L2R_L2LOSS_SVC'> and C<'L2R_L2LOSS_SVR'>. Error will be thrown for otherwise.
When C<update> is set true, the instance is updated to use the found parameters. This behaviour is disabled by default.
Return value is an ArrayRef containing 3 values: found C<cost>, found C<loss_sensitivity> (only if solver is C<'L2R_L2LOSS_SVR'>) and mean accuracy of cross validation with the found parameters.
=head2 train(data_set => $data_set)
Executes training and returns a trained L<Algorithm::LibLinear::Model> instance.
C<data_set> is same as the C<cross_validation>'s.
=head1 AUTHOR
lib/Algorithm/LibLinear.pm view on Meta::CPAN
Deprecated. Use C<find_parameters> instead.
Shorthand alias for C<find_parameters> only works on C<cost> parameter.
Notice that C<loss_sensitivity> is affected too when C<update> is set.
=head2 find_parameters(data_set => $data_set, num_folds => $num_folds [, initial_cost => -1.0] [, initial_loss_sensitivity => -1.0] [, update => 0])
Finds the best parameters by N-fold cross validation. If C<initial_cost> or C<initial_loss_sensitivity> is a negative, the value is automatically calculated.
Works only for 3 solvers: C<'L2R_LR'>, C<'L2R_L2LOSS_SVC'> and C<'L2R_L2LOSS_SVR'>. Error will be thrown for otherwise.
When C<update> is set true, the instance is updated to use the found parameters. This behaviour is disabled by default.
Return value is an ArrayRef containing 3 values: found C<cost>, found C<loss_sensitivity> (only if solver is C<'L2R_L2LOSS_SVR'>) and mean accuracy of cross validation with the found parameters.
=head2 train(data_set => $data_set)
Executes training and returns a trained L<Algorithm::LibLinear::Model> instance.
C<data_set> is same as the C<cross_validation>'s.
=head1 AUTHOR
src/liblinear/linear.cpp view on Meta::CPAN
return f;
}
int l2r_erm_fun::get_nr_variable(void)
{
return prob->n;
}
// On entry *f must be the function value of w
// On exit w is updated and *f is the new function value
double l2r_erm_fun::linesearch_and_update(double *w, double *s, double *f, double *g, double alpha)
{
int i;
int l = prob->l;
double sTs = 0;
double wTs = 0;
double gTs = 0;
double eta = 0.01;
int w_size = get_nr_variable();
int max_num_linesearch = 20;
src/liblinear/newton.cpp view on Meta::CPAN
}
#endif
static void default_print(const char *buf)
{
fputs(buf,stdout);
fflush(stdout);
}
// On entry *f must be the function value of w
// On exit w is updated and *f is the new function value
double function::linesearch_and_update(double *w, double *s, double *f, double *g, double alpha)
{
double gTs = 0;
double eta = 0.01;
int n = get_nr_variable();
int max_num_linesearch = 20;
double *w_new = new double[n];
double fold = *f;
for (int i=0;i<n;i++)
( run in 0.429 second using v1.01-cache-2.11-cpan-05444aca049 )