Algorithm::Numerical::Sample

Algorithm::Numerical::Sample is a Perl module that can draw samples from a set.
Download

Algorithm::Numerical::Sample Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Abigail
  • Publisher web site:
  • http://search.cpan.org/~abigail/

Algorithm::Numerical::Sample Tags


Algorithm::Numerical::Sample Description

Algorithm::Numerical::Sample is a Perl module that can draw samples from a set. Algorithm::Numerical::Sample is a Perl module that can draw samples from a set.SYNOPSIS use Algorithm::Numerical::Sample qw /sample/; @sample = sample (-set => , -sample_size => 100); $sampler = Algorithm::Numerical::Sample::Stream -> new; while () {$sampler -> data ($_)} $random_line = $sampler -> extract;This package gives two methods to draw fair, random samples from a set. There is a procedural interface for the case the entire set is known, and an object oriented interface when the a set with unknown size has to be processed.A: sample (set => ARRAYREF )The sample function takes a set and a sample size as arguments. If the sample size is omitted, a sample of 1 is taken. The keywords set and sample_size may be preceeded with an optional -. The function returns the sample list, or a reference to the sample list, depending on the context.B: Algorithm::Numerical::Sample::StreamThe class Algorithm::Numerical::Sample::Stream has the following methods:newThis function returns an object of the Algorithm::Numerical::Sample::Stream class. It will take an optional argument of the form sample_size => EXPR, where EXPR evaluates to the sample size to be taken. If this argument is missing, a sample of size 1 will be taken. The keyword sample_size may be preceeded by an optional dash.data (LIST)The method data takes a list of parameters which are elements of the set we are sampling. Any number of arguments can be given.extractThis method will extract the sample from the object, and reset it to a fresh state, such that a sample of the same size but from a different set, can be taken. extract will return a list in list context, or the first element of the sample in scalar context. Requirements: · Perl


Algorithm::Numerical::Sample Related Software