NAME
Algorithm::AM - Classify data with Analogical Modeling
VERSION
version 3.03
SYNOPSIS
use Algorithm::AM;
my $dataset = dataset_from_file('finnverb');
my $am = Algorithm::AM->new(training_set => $dataset);
my $result = $am->classify($dataset->get_item(0));
print @{ $result->winners };
print ${ $result->statistical_summary };
DESCRIPTION
Analogical Modeling is an exemplar-based way to model language usage. This module analyzes data sets using Analogical Modeling, an exemplar-based approach to modeling language usage or other sticky phenomena. This module logs information using Log::Any, so if you want automatic print-outs you need to set an adaptor. See the "classify" method for more information on logged data.
EXPORTS
When this module is imported, it also imports the following:
- Algorithm::AM::Result
- Algorithm::AM::DataSet
-
Also imports the "dataset_from_file" in Algorithm::AM::DataSet function.
- Algorithm::AM::DataSet::Item
-
Also imports the "new_item" in Algorithm::AM::DataSet::Item function.
- Algorithm::AM::BigInt
-
Also imports the "bigcmp" in Algorithm::AM::BigInt function.
METHODS
new
Creates a new instance of an analogical modeling classifier. This method takes named parameters which set set state described in the documentation for the relevant methods. The only required parameter is "training_set", which should be an instance of Algorithm::AM::DataSet, and which defines the set of items used for training during classification. All of the accepted parameters are listed below:
training_set
Returns (but will not set) the dataset used for training. This is an instance of Algorithm::AM::DataSet.
exclude_nulls
Get/set a boolean value indicating whether features with null values in the test item should be ignored. If false, they will be treated as having a specific value representing null. Defaults to true.
exclude_given
Get/set a boolean value indicating whether the test item should be removed from the training set if it is found there during classification. Defaults to true.
linear
Get/set a boolean value indicating whether the analogical set should be computed using occurrences (linearly) or pointers (quadratically). To understand what this means, you should read the algorithm page. A false value indicates quadratic counting. Defaults to false.
classify
$am->classify(new_item(features => ['a','b','c']));
Using the analogical modeling algorithm, this method classifies the input test item and returns a Result object.
Log::Any is used for logging. The full classification configuration is logged at the info level. A notice is printed at the warning level if no training items can be compared with the test item, preventing any classification.
HISTORY
Initially, Analogical Modeling was implemented as a Pascal program. Subsequently, it was ported to Perl, with substantial improvements made in 2000. In 2001, the core of the algorithm was rewritten in C, while the parsing, printing, and statistical routines remained in C; this was accomplished by embedding a Perl interpreter into the C code.
In 2004, the algorithm was again rewritten, this time in order to handle more features and large data sets. The algorithm breaks the supracontextual lattice into the direct product of four smaller ones, which the algorithm manipulates individually before recombining. These lattices can be manipulated in parallel when using the right hardware, and so the module was named AM::Parallel
. This implementation was written with the core lattice-filling algorithm in XS, and hooks were provided to help the user create custom reports and control classification dynamically.
The present version has been renamed to Algorithm::AM
, which seemed a better fit for CPAN. While the XS has largely remained intact, the Perl code has been completely reorganized and updated to be both more "modern" and modular. Most of the functionality of AM::Parallel
remains.
SEE ALSO
The <home page|http://humanities.byu.edu/am/> for Analogical Modeling includes information about current research and publications, as well as sample data sets.
The Wikipedia article has details and even illustrations on analogical modeling.
AUTHOR
Theron Stanford <shixilun@yahoo.com>, Nathan Glenn <garfieldnate@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Royal Skousen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.