AI-MaxEntropy
view release on metacpan or search on metacpan
lib/AI/MaxEntropy/Util.pm view on Meta::CPAN
];
my $me = AI::MaxEntropy->new;
# see the first one third and the last one third samples
traverse_partially { $me->see(@$_) } $samples, 'x-x';
=head2 map_partially
This function is similar to L</traverse_partially>. However, it returns an
array ref in which all elements in the original array is mapped according
to the code snippet's return value.
my $arr = [1, 2, 3, 4, 5];
# increase the last one third of the elements by 1
$arr = map_partially { $_ + 1 } $arr, '--x';
=head2 precision
Calculates the precision based on the result returned by
L</train_and_test>.
...
my ($result, $model) = train_and_test(...);
print precision($result)."\n";
Note that the weights of samples are taken into consideration.
=head2 recall
Calculates the recall of a certain label based on the result returned by
L</train_and_test>.
...
my ($result, $model) = train_and_test(...);
print recall($result, 'label')."\n";
Note that the weights of samples are taken into consideration.
=head1 SEE ALSO
L<AI::MaxEntropy>, L<AI::MaxEntropy::Model>
=head1 AUTHOR
Laye Suen, E<lt>laye@cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
The MIT License
Copyright (C) 2008, Laye Suen
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, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
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 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
( run in 0.648 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )