Click or drag to resize
Accord.NET (logo)

FuzzySet Class

The class represents a fuzzy set.
Inheritance Hierarchy
SystemObject
  Accord.FuzzyFuzzySet

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

The FuzzySet type exposes the following members.

Constructors
  NameDescription
Public methodFuzzySet
Initializes a new instance of the FuzzySet class.
Top
Properties
  NameDescription
Public propertyLeftLimit
The leftmost x value of the fuzzy set's membership function.
Public propertyName
Name of the fuzzy set.
Public propertyRightLimit
The rightmost x value of the fuzzy set's membership function.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
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 methodGetMembership
Calculate membership of a given value to the fuzzy set.
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 a string that represents the current object.
(Inherited from Object.)
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

The fuzzy sets are the base for all fuzzy applications. In a classical set, the membership of a given value to the set can always be defined as true (1) or false (0). In fuzzy sets, this membership can be a value in the range [0..1], representing the imprecision existent in many real world applications.

Let us consider, for example, fuzzy sets representing some temperature. In a given application, there is the need to represent a cool and warm temperature. Like in real life, the precise point when the temperature changes from cool to warm is not easy to find, and does not makes sense. If we consider the cool around 20 degrees and warm around 30 degrees, it is not simple to find a break point. If we take the mean, we can consider values greater than or equal 25 to be warm. But we can still consider 25 a bit cool. And a bit warm at the same time. This is where fuzzy sets can help.

Fuzzy sets are often used to compose Linguistic Variables, used in Fuzzy Inference Systems.

Sample usage:

// creating 2 fuzzy sets to represent Cool and Warm
TrapezoidalFunction function1 = new TrapezoidalFunction( 13, 18, 23, 28 );
FuzzySet fsCool = new FuzzySet( "Cool", function1 );
TrapezoidalFunction function2 = new TrapezoidalFunction( 23, 28, 33, 38 );
FuzzySet fsWarm = new FuzzySet( "Warm", function2 );

// show membership to the Cool set for some values 
Console.WriteLine( "COOL" );
for ( int i = 13; i <= 28; i++ )
    Console.WriteLine( fsCool.GetMembership( i ) );

// show membership to the Warm set for some values 
Console.WriteLine( "WARM" );
for ( int i = 23; i <= 38; i++ )
    Console.WriteLine( fsWarm.GetMembership( i ) );
See Also