Algorithm-SVMLight

 view release on metacpan or  search on metacpan

lib/Algorithm/SVMLight.pm  view on Meta::CPAN

package Algorithm::SVMLight;

use strict;
use DynaLoader ();

use vars qw($VERSION @ISA);

$VERSION = '0.09';
@ISA = qw(DynaLoader);
__PACKAGE__->bootstrap( $VERSION );


sub new {
  my $package = shift;
  my $self = bless {
		    @_,
		    features => {},
		    rfeatures => [undef],
		   }, $package;
  $self->_xs_init;
  $self->_param_init(@_);
  return $self;
}

my %params = map {$_,1}
  qw(
     type
     svm_c
     eps
     svm_costratio
     transduction_posratio
     biased_hyperplane
     sharedslack
     svm_maxqpsize
     svm_newvarsinqp
     kernel_cache_size
     epsilon_crit
     epsilon_shrink
     svm_iter_to_shrink
     maxiter
     remove_inconsistent
     skip_final_opt_check
     compute_loo
     rho
     xa_depth
     predfile
     alphafile

     kernel_type
     poly_degree
     rbf_gamma
     coef_lin
     coef_const
     custom
    );


sub _param_init {
  my ($self, %args) = @_;

  while (my ($k, $v) = each %args) {
    if (exists $params{$k}) {
      my $method = "set_$k";
      $self->$method($v);
    } else {
      die "Unknown parameter '$k'\n";
    }
  }
}

sub is_trained {
  my $self = shift;
  return exists $self->{_model};
}



( run in 1.300 second using v1.01-cache-2.11-cpan-e93a5daba3e )