Algorithm-LossyCount

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

      my $counter = Algorithm::LossyCount->new(max_error_ratio => 0.005);
      $counter->add_sample($_) for @samples;
  
      my $frequencies = $counter->frequencies;
      say $frequencies->{a};  # Approximate freq. of 'a'.
      say $frequencies->{b};  # Approximate freq. of 'b'.
      ...

DESCRIPTION
    Lossy-Counting is a approximate frequency counting algorithm proposed by
    Manku and Motwani in 2002 (refer "SEE ALSO" section below.)

    The main advantage of the algorithm is memory efficiency. You can get
    approximate count of appearance of items with very low memory footprint,
    compared with total inspection. Furthermore, Lossy-Counting is an online
    algorithm. It is applicable to data set such that the size is unknown,
    and you can take intermediate result anytime.

METHODS
  new(max_error_ratio => $num)
    Construcotr. "max_error_ratio" is the only mandatory parameter, that

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

  my $counter = Algorithm::LossyCount->new(max_error_ratio => 0.005);
  $counter->add_sample($_) for @samples;
  
  my $frequencies = $counter->frequencies;
  say $frequencies->{a};  # Approximate freq. of 'a'.
  say $frequencies->{b};  # Approximate freq. of 'b'.
  ...

=head1 DESCRIPTION

Lossy-Counting is a approximate frequency counting algorithm proposed by Manku and Motwani in 2002 (refer L<SEE ALSO> section below.)

The main advantage of the algorithm is memory efficiency. You can get approximate count of appearance of items with very low memory footprint, compared with total inspection.
Furthermore, Lossy-Counting is an online algorithm. It is applicable to data set such that the size is unknown, and you can take intermediate result anytime.

=head1 METHODS

=head2 new(max_error_ratio => $num)

Construcotr. C<max_error_ratio> is the only mandatory parameter, that specifies acceptable error ratio. It is an error that give zero or a negative number as the value.



( run in 0.565 second using v1.01-cache-2.11-cpan-39bf76dae61 )