Accord.Fuzzy.FuzzyOutput.AddOutput C# (CSharp) Method

AddOutput() private method

Adds an output to the Fuzzy Output.
The label indicated was not found in the linguistic variable.
private AddOutput ( string labelName, float firingStrength ) : void
labelName string The name of a label representing a fuzzy rule's output.
firingStrength float The firing strength [0..1] of a fuzzy rule.
return void
        internal void AddOutput( string labelName, float firingStrength )
        {
            // check if the label exists in the linguistic variable
            this.outputVar.GetLabel( labelName );

            // adding label
            this.outputList.Add( new OutputConstraint( labelName, firingStrength ) );
        }

Usage Example

        /// <summary>
        /// Executes the fuzzy inference, obtaining the <see cref="FuzzyOutput"/> of the system for the required
        /// <see cref="LinguisticVariable"/>.
        /// </summary>
        ///
        /// <param name="variableName">Name of the <see cref="LinguisticVariable"/> to evaluate.</param>
        ///
        /// <returns>A <see cref="FuzzyOutput"/> containing the fuzzy output of the system for the
        /// <see cref="LinguisticVariable"/> specified in <paramref name="variableName"/>.</returns>
        ///
        /// <exception cref="KeyNotFoundException">The variable indicated was not found in the database.</exception>
        ///
        public FuzzyOutput ExecuteInference(string variableName)
        {
            // gets the variable
            LinguisticVariable lingVar = database.GetVariable(variableName);

            // object to store the fuzzy output
            FuzzyOutput fuzzyOutput = new FuzzyOutput(lingVar);

            // select only rules with the variable as output
            Rule[] rules = rulebase.GetRules( );
            foreach (Rule r in rules)
            {
                if (r.Output.Variable.Name == variableName)
                {
                    string labelName      = r.Output.Label.Name;
                    float  firingStrength = r.EvaluateFiringStrength( );
                    if (firingStrength > 0)
                    {
                        fuzzyOutput.AddOutput(labelName, firingStrength);
                    }
                }
            }

            // returns the fuzzy output obtained
            return(fuzzyOutput);
        }
All Usage Examples Of Accord.Fuzzy.FuzzyOutput::AddOutput