pub fn aggregation<KI, KV>(
rules: &[Rule],
input: &HashMap<KI, Float>,
vars: &HashMap<KV, Variable>,
sampler: &UniformSampler,
) -> Result<HashMap<String, Vec<Float>>>Expand description
Aggregate the contributions of all rules into output membership functions.
For each Rule, this function computes its activation (Rule::activation)
from input and vars, applies implication (Rule::implicate) to obtain
output membership sample vectors, then merges those vectors into a single
map keyed by output variable name using pointwise maxima.
Type parameters and bounds:
KI: key type for the input map (must borrow asstr) — e.g.,&str,String, orArc<str>.KV: key type for the variables map (must borrow asstr).
Returns a map from output variable name to its aggregated membership samples
(length sampler.n).
Errors
- Propagates
FuzzyError::NotFoundif an input or variable is missing. - Propagates
FuzzyError::TypeMismatchif a term name is unknown. - Propagates
FuzzyError::OutOfBoundsif inputs are outside variable domains.
Performance
- Time: O(R * C * N) where
R= rules,C= average number of consequents per rule, andN= sampler resolution per variable. - Memory: O(V * N) for the aggregated output across
Voutput variables.