Algorithm-AM
view release on metacpan or search on metacpan
bin/analogize.pl view on Meta::CPAN
'format=s',
'exemplars|train|data:s',
'project:s',
'test:s',
'print:s',
'include_given',
'include_nulls',
'linear',
'help|?',
) or pod2usage(2);
_validate_args(%args);
my @print_methods;
if($args{print}){
@print_methods = split ',', $args{print};
}
my ($train, $test);
if($args{exemplars}){
$train = dataset_from_file(
path => $args{exemplars},
bin/analogize.pl view on Meta::CPAN
}
}
}
);
$batch->classify_all($test);
say "$count out of " . $test->size . " correct";
return;
}
sub _validate_args {
my %args = @_;
if($args{help}){
pod2usage(1);
}
my $errors = '';
if(!$args{exemplars} and !$args{project}){
$errors .= "Error: need either --exemplars or --project parameters\n";
}elsif(($args{exemplars} or $args{test}) and $args{project}){
$errors .= "Error: --project parameter cannot be used with --exempalrs or --test\n";
}
uvoffuni_to_utf8_flags|5.027009||cV
uvoffuni_to_utf8_flags_msgs|5.027009||cVu
UVSIZE|5.006000|5.003007|poVn
UVTYPE|5.006000|5.003007|poVn
UVuf|5.006000|5.003007|p
uvuni_to_utf8|5.019004||cVu
uvuni_to_utf8_flags|5.007003||dcV
UVxf|5.006000|5.003007|p
UVXf|5.007001|5.007001|poVn
VAL_EAGAIN|5.003007|5.003007|Vn
validate_proto|5.019002||xcVi
validate_suid|||iu
valid_utf8_to_uvchr|5.015009||cVn
valid_utf8_to_uvuni|5.015009||dcVu
VAL_O_NONBLOCK|5.003007|5.003007|Vn
variant_byte_number|5.031004||cVnu
variant_under_utf8_count|5.027007||Vni
varname|5.009003||Viu
vcmp|5.009000|5.009000|
VCMP|5.019008||Viu
vcroak|5.006000|5.006000|
vdeb|5.007003|5.007003|u
t/02-DataSet.t view on Meta::CPAN
lives_ok {
Algorithm::AM::DataSet->new(
cardinality => 3,
);
} 'constructor lives with normal input';
my $dataset = Algorithm::AM::DataSet->new(cardinality => 3);
is($dataset->cardinality, 3, 'cardinality set by constructor');
return;
}
# test that add_item correctly adds data to the set and validates input
# TODO: rename this something more descriptive
sub test_data {
# first check empty DataSet
my $dataset = Algorithm::AM::DataSet->new(cardinality => 3);
is($dataset->size, 0, 'new data set has 0 items');
is($dataset->num_classes, 0, 'new data set has 0 classes');
$dataset->add_item(
features => ['a','b','c'],
class => 'b',
( run in 0.573 second using v1.01-cache-2.11-cpan-a5abf4f5562 )