AI-FuzzyInference
view release on metacpan or search on metacpan
FuzzyInference.pm view on Meta::CPAN
'service=poor & food=good' => 'tip=poor',
'service=good & food=good' => 'tip=good',
'service=excellent & food=good' => 'tip=good',
'service=amazing & food=good' => 'tip=excellent',
'service=poor & food=excellent' => 'tip=good',
'service=good & food=excellent' => 'tip=excellent',
'service=excellent & food=excellent' => 'tip=excellent',
'service=amazing & food=excellent' => 'tip=amazing',
'service=poor & food=amazing' => 'tip=good',
'service=good & food=amazing' => 'tip=excellent',
'service=excellent & food=amazing' => 'tip=amazing',
'service=amazing & food=amazing' => 'tip=amazing',
);
$s->compute(service => 2,
food => 7);
=head1 DESCRIPTION
This module implements a fuzzy inference system. Very briefly, an FIS
is a system defined by a set of input and output variables, and a set
of fuzzy rules relating the input variables to the output variables.
Given crisp values for the input variables, the FIS uses the fuzzy rules
to compute a crisp value for each of the output variables.
The operation of an FIS is split into 4 distinct parts: I<fuzzification>,
I<inference>, I<aggregation> and I<defuzzification>.
=head2 Fuzzification
In this step, the crisp values of the input variables are used to
compute a degree of membership of each of the input variables in each
of its term sets. This produces a set of fuzzy sets.
=head2 Inference
In this step, all the defined rules are examined. Each rule has two parts:
the I<precedent> and the I<consequent>. The degree of support for each
rule is computed by applying fuzzy operators (I<and>, I<or>) to combine
all parts of its precendent, and generate a single crisp value. This value
indicates the "strength of firing" of the rule, and is used to reshape
(I<implicate>) the consequent part of the rule, generating modified
fuzzy sets.
=head2 Aggregation
Here, all implicated fuzzy sets of the fired rules are combined using
fuzzy operators to generate a single fuzzy set for each of the
output variables.
=head2 Defuzzification
Finally, a defuzzification operator is applied to the aggregated fuzzy
set to generate a single crisp value for each of the output variables.
For a more detailed explanation of fuzzy inference, you can check out
the tutorial by Jerry Mendel at
S<http://sipi.usc.edu/~mendel/publications/FLS_Engr_Tutorial_Errata.pdf>.
Note: The terminology used in this module might differ from that used
in the above tutorial.
=head1 PUBLIC METHODS
The module has the following public methods:
=over 4
=item new()
This is the constructor. It takes no arguments, and returns an
initialized AI::FuzzyInference object.
=item operation()
This method is used to set/query the fuzzy operations. It takes at least
one argument, and at most 2. The first argument specifies the logic
operation in question, and can be either C<&> for logical I<AND>,
C<|> for logical I<OR>, or C<!> for logical I<NOT>. The second
argument is used to set what method to use for the given operator.
The following values are possible:
=item &
=over 8
=item min
The result of C<A and B> is C<min(A, B)>. This is the default.
=item product
The result of C<A and B> is C<A * B>.
=back
=item |
=over 8
=item max
The result of C<A or B> is C<max(A, B)>. This is the default.
=item sum
The result of C<A or B> is C<min(A + B, 1)>.
=back
=item !
=over 8
=item complement
The result of C<not A> is C<1 - A>. This is the default.
( run in 1.211 second using v1.01-cache-2.11-cpan-4ab04211f4c )