Clause Class |
Namespace: Accord.Fuzzy
The Clause type exposes the following members.
Name | Description | |
---|---|---|
Label |
Gets the FuzzySet of the Clause.
| |
Variable |
Gets the LinguisticVariable of the Clause.
|
Name | Description | |
---|---|---|
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
Evaluate |
Evaluates the fuzzy clause.
| |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString |
Returns the fuzzy clause in its linguistic representation.
(Overrides ObjectToString.) |
Name | Description | |
---|---|---|
HasMethod |
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.) | |
IsEqual |
Compares two objects for equality, performing an elementwise
comparison if the elements are vectors or matrices.
(Defined by Matrix.) | |
To(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.) | |
ToT | 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.) |
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());