Algorithm-LibLinear

 view release on metacpan or  search on metacpan

README.pod  view on Meta::CPAN

=item 'L1R_LR_DUAL' -  L1-regularized logistic regression (dual problem)

=back

For regression:

=over 4

=item 'L2R_L2LOSS_SVR' - L2-regularized L2-loss SVR (primal problem)

=item 'L2R_L2LOSS_SVR_DUAL' - L2-regularized L2-loss SVR (dual problem)

=item 'L2R_L1LOSS_SVR_DUAL' - L2-regularized L1-loss SVR (dual problem)

=back

For outlier detection:

=over 4

=item 'ONECLASS_SVM' - One-class SVM

=back

=item weights

Weights to adjust the cost parameter of different classes (C<-wi>.)

For example,

  my $learner = Algorithm::LibLinear->new(
    weights => [
      +{ label => 1, weight => 0.5 },
      +{ label => 2, weight => 1 },
      +{ label => 3, weight => 0.5 },
    ],
  );

is giving a doubling weight for class 2. This means that samples belonging to class 2 have stronger effect than other samples belonging class 1 or 3 on learning.

This option is useful when the number of training samples of each class is not balanced.

=back

=head2 cross_validation(data_set => $data_set, num_folds => $num_folds)

Evaluates training parameter using N-fold cross validation method.
Given data set will be split into N parts. N-1 of them will be used as a training set and the rest 1 part will be used as a test set.
The evaluation iterates N times using each different part as a test set. Then average accuracy is returned as result.

=head2 find_cost_parameter(data_set => $data_set, num_folds => $num_folds [, initial => -1.0] [, update => 0])

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

Koichi SATO E<lt>sekia@cpan.orgE<gt>

=head1 SEE ALSO

L<Algorithm::LibLinear::DataSet>

L<Algorithm::LibLinear::FeatureScaling>

L<Algorithm::LibLinear::Model>

L<LIBLINEAR Homepage|http://www.csie.ntu.edu.tw/~cjlin/liblinear/>

L<Algorithm::SVM> - A Perl binding to LIBSVM.

=head1 LICENSE

=head2 Algorithm::LibLinear

Copyright (c) 2013-2023 Koichi SATO. All rights reserved.

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modi...

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOL...

=head2 LIBLINEAR

Copyright (c) 2007-2023 The LIBLINEAR Project.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither name of copyright holders nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.



( run in 0.870 second using v1.01-cache-2.11-cpan-4991d5b9bd9 )