Algorithm-LibLinear

 view release on metacpan or  search on metacpan

lib/Algorithm/LibLinear/DataSet.pm  view on Meta::CPAN

use Smart::Args::TypeTiny;
use Types::Standard qw/ArrayRef ClassName FileHandle InstanceOf Num Str/;

my $InstanceOfPackage = InstanceOf[__PACKAGE__];

sub new {
    args
        my $class => ClassName,
        my $data_set => ArrayRef[FeatureWithLabel];

    bless +{ data_set => $data_set } => $class;
}

sub load {
    args
        my $class => ClassName,
        my $fh => +{ isa => FileHandle, optional => 1, },
        my $filename => +{ isa => Str, optional => 1, },
        my $string => +{ isa => Str, optional => 1, };

    if (none { defined } ($fh, $filename, $string)) {

lib/Algorithm/LibLinear/Model.pm  view on Meta::CPAN

use Smart::Args::TypeTiny;
use Types::Standard qw/ClassName InstanceOf Int Str/;

my $InstanceOfPackage = InstanceOf[__PACKAGE__];

sub new {
    args
        my $class => ClassName,
        my $raw_model => InstanceOf['Algorithm::LibLinear::Model::Raw'];

    bless +{ raw_model => $raw_model, } => $class;
}

sub load {
    args
        my $class => ClassName,
        my $filename => Str;

    my $raw_model = Algorithm::LibLinear::Model::Raw->load($filename);
    $class->new(raw_model => $raw_model);
}



( run in 1.335 second using v1.01-cache-2.11-cpan-49f99fa48dc )