Click or drag to resize
Accord.NET (logo)

Clause Class

This class represents a fuzzy clause, a linguistic expression of the type "Variable IS Value".
Inheritance Hierarchy
SystemObject
  Accord.FuzzyClause

Namespace:  Accord.Fuzzy
Assembly:  Accord.Fuzzy (in Accord.Fuzzy.dll) Version: 3.8.0
Syntax
public class Clause
Request Example View Source

The Clause type exposes the following members.

Constructors
  NameDescription
Public methodClause
Initializes a new instance of the Clause class.
Top
Properties
  NameDescription
Public propertyLabel
Gets the FuzzySet of the Clause.
Public propertyVariable
Gets the LinguisticVariable of the Clause.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodEvaluate
Evaluates the fuzzy clause.
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns the fuzzy clause in its linguistic representation.
(Overrides ObjectToString.)
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodIsEqual
Compares two objects for equality, performing an elementwise comparison if the elements are vectors or matrices.
(Defined by Matrix.)
Public Extension MethodTo(Type)Overloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Top
Remarks

A Fuzzy Clause is used to verify if a linguistic variable can be considered as a specific value at a specific moment. Linguistic variables can only assume value of their linguistic labels. Because of the nature of the Fuzzy Logic, a Variable can be several of its labels at the same time, with different membership values.

For example, a linguistic variable "temperature" can be "hot" with a membership 0.3 and "warm" with a membership 0.7 at the same time. To obtain those memberships, Fuzzy Clauses "temperature is hot" and "temperature is war" can be built.

Typically Fuzzy Clauses are used to build Fuzzy Rules (Rule).

Sample usage:

// create a linguistic variable to represent temperature
LinguisticVariable lvTemperature = new LinguisticVariable("Temperature", 0, 80 );

// create the linguistic labels (fuzzy sets) that compose the temperature 
TrapezoidalFunction function1 = new TrapezoidalFunction(10, 15, TrapezoidalFunction.EdgeType.Right);
FuzzySet fsCold = new FuzzySet("Cold", function1);
TrapezoidalFunction function2 = new TrapezoidalFunction(10, 15, 20, 25);
FuzzySet fsCool = new FuzzySet("Cool", function2);
TrapezoidalFunction function3 = new TrapezoidalFunction(20, 25, 30, 35);
FuzzySet fsWarm = new FuzzySet("Warm", function3);
TrapezoidalFunction function4 = new TrapezoidalFunction(30, 35, TrapezoidalFunction.EdgeType.Left);
FuzzySet fsHot  = new FuzzySet("Hot", function4);

// adding labels to the variable
lvTemperature.AddLabel(fsCold);
lvTemperature.AddLabel(fsCool);
lvTemperature.AddLabel(fsWarm);
lvTemperature.AddLabel(fsHot);

// creating the Clause
Clause fuzzyClause = new Clause(lvTemperature, fsHot);
// setting the numerical input of the variable to evaluate the Clause
lvTemperature.NumericInput = 35;
float result = fuzzyClause.Evaluate();
Console.WriteLine(result.ToString());
See Also