File Coverage

blib/lib/Algorithm/LibLinear/Types.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Algorithm::LibLinear::Types;
2              
3 5     5   70 use 5.014;
  5         14  
  5         169  
4 5     5   2951 use Mouse::Util::TypeConstraints;
  5         80618  
  5         30  
5              
6             subtype 'Algorithm::LibLinear::Feature'
7             => as 'HashRef[Num]'
8             => where {
9             for my $index (keys %$_) {
10             return unless $index == int $index and $index > 0;
11             }
12             return 1;
13             };
14              
15             subtype 'Algorithm::LibLinear::LabeledData'
16             => as 'HashRef'
17             => where {
18             return if keys %$_ != 2;
19             for my $key (qw/feature label/) { return unless exists $_->{$key} }
20             state $label_type = find_type_constraint 'Num';
21             state $feature_type =
22             find_type_constraint 'Algorithm::LibLinear::Feature';
23             $label_type->check($_->{label}) and $feature_type->check($_->{feature});
24             };
25              
26             subtype 'Algorithm::LibLinear::TrainingParameter::ClassWeight'
27             => as 'HashRef'
28             => where {
29             return if keys %$_ != 2;
30             for my $key (qw/label weight/) { return unless exists $_->{$key} }
31             state $label_type = find_type_constraint 'Int';
32             state $weight_type = find_type_constraint 'Num';
33             $label_type->check($_->{label}) and $weight_type->check($_->{weight});
34             };
35              
36             enum 'Algorithm::LibLinear::SolverDescriptor' => [
37             qw/L2R_LR L2R_L2LOSS_SVC_DUAL L2R_L2LOSS_SVC L2R_L1LOSS_SVC_DUAL MCSVM_CS
38             L1R_L2LOSS_SVC L1R_LR L2R_LR_DUAL L2R_L2LOSS_SVR L2R_L2LOSS_SVR_DUAL
39             L2R_L1LOSS_SVR_DUAL/
40             ];
41              
42 5     5   1806 no Mouse::Util::TypeConstraints;
  5         10  
  5         27  
43              
44             1;