Fuzzy Set and membership function-Use of aforge. NET Framework (1)

Source: Internet
Author: User
What is aforge. Net?

Aforge. Net is a framework developed for developers and researchers. It can be used in computer vision, geneticAlgorithm, Image processing, neural networks, Robot Learning and control, machine learning and fuzzy systems.

Aforge. Net has a wide range of official documents, and some related documents are available on the Internet.ArticleBut most of them are about vision and neural networks. I am personally interested in the fuzzy system, so I wrote some of my feelings.

Fuzzy System and Fuzzy Theory

Fuzzy systems are different from classic systems (or conventional systems ). When researching man-machine systems, management systems, especially economic and social systems, many decisions are hard to be completely accurate due to the logic, reasoning, and judgment of people, these human-related systems have some ambiguity.

In a conventional system, if the status and input of a system are determined at a certain moment, the status and output at the next time can be determined. If the next state cannot be determined, but the probability distribution can be given, it becomes a random system. If the probability distribution cannot be given, but the set of all possible states can be given, and the set of all possible states is represented by a fuzzy set, it becomes a fuzzy system.

There are general fuzzy phenomena in the objective world. For example, "Young people" and "old people" are vague concepts. They do not have a clear connotation or extension, but there are few misunderstandings and ambiguities when using these concepts. It can be said that value Logic is only an ideal world model, not a real world model.

Membership Function and Fuzzy Sets)

The membership function is the mathematical basis of the fuzzy system. It breaks through the limitations of the classical set theory and the quantitative expression of the fuzzy concept becomes possible.

A brown curve is a membership function. 0 does not belong to, and 1 completely belongs. Because of its ambiguity, the numbers on [0, 1] are used to replace 0 and 1.

This value is the degree of Fuzzy Set.

A fuzzy set can be divided into two parts, one of which becomes the core, which is a loose set where the membership of each X is 1.

Another part is boundary, which contains all elements with a degree of membership between 0 and 1.

The choice of membership function is mainly determined by the fuzzy set. If a set contains a large number of values or is continuous, a parameterized membership function is suitable. A linear membership function (piecewise linear membership functions) is relatively good, it is simple and efficient in computing. Generally, a trapezoid or triangle is defined by four or three parameters.

Take temperature as an example. In actual life, we often say how many degrees, cold or cold. The number of degrees can be a definite value or interval, but it cannot be fixed if it is cold or cold, and it is difficult to find a fixed blasting value. Generally, it can be cold, warm, or hot.

The membership function is considered as a (x) = warm.

 

This is hot.

Aforge. Net indicates a fuzzy set and Membership Function

Aforge, aforge. fuzzy, and aforge. controls are required.

Aforge is the core class. aforge. Fuzzy is related to fuzzy systems, while aforge. controls is a number of controls, which are commonly used as table (Chart) controls.

You can go to http://code.google.com/p/aforge/to download the example. I used nuget directly.

Aforge. Fuzzy does not exist in nuget.

The piecewiselinearfunction class is undoubtedly the most flexible. However, if the membership function is a trapezoid or triangle, a faster class is available: trapezoidalfunction.

For example, we want to create a trapezoid membership function, if:

Note that (10, 0) and (40, 0) are boundary boundaries. (20, 0) and (30, 0) are core boundaries.

 
Trapezoidalfunction functioncool =NewTrapezoidalfunction (10,20,30,40);

Fuzzyset fscool =NewFuzzyset ("Cold", Functioncool );

Use fuzzyset. getmembership (I) to obtain the membership level. Then, you can create a two-dimensional array for the chart control.

Double[,] Coolvalues =New Double[50,2];
For(IntI =0; I <50; I ++)
{
Coolvalues [I,0] = I;
Coolvalues [I,1] = Fscool. getmembership (I );
}
 
Chart. updatedataseries ("cold", coolvalues );

Effect:

Of course, functions that lack half of the boundary are also commonly used.

The key points are (30, 0) and (40, 0 ).

Trapezoidalfunction functioncool = New Trapezoidalfunction (30 , 40 , Trapezoidalfunction. edgetype. Right );
Fuzzyset fscool = New Fuzzyset ( " Warm " , Functioncool );

Double [,] Coolvalues = New Double [ 50 , 2 ];
For (Int I = 0 ; I < 50 ; I ++)
{
Coolvalues [I, 0 ] = I;
Coolvalues [I, 1 ] = Fscool. getmembership (I );
}

Chart. updatedataseries ( " Warm " , Coolvalues );

Effect:

Triangle functions:

Trapezoidalfunction functioncool =NewTrapezoidalfunction (20,30,40);

Of course, piecewiselinearfunction can have more abundant performances. You only need to specify the key points to create many functions.

Aforge. Point [] points = New Aforge. Point [ 6 ];

Points [ 0 ] = New Aforge. Point ( 10 , 0 );
Points [ 1 ] =New Aforge. Point ( 12 , 0.8f );
Points [ 2 ] = New Aforge. Point ( 20 , 0.9f );
Points [ 3 ] = New Aforge. Point ( 30 , 1 );
Points [ 4 ] = New Aforge. Point ( 40 , 0.1f );
Points [ 5 ] = New Aforge. Point ( 50 , 0 );

Piecewiselinearfunction membershipfunction = New Piecewiselinearfunction (points );

Fuzzyset fscool = New Fuzzyset ( " Hot " , Membershipfunction );

Double [,] Coolvalues = New Double [ 50 , 2 ];
For ( Int I = 0 ; I < 50 ; I ++)
{
Coolvalues [I, 0 ] = I;
Coolvalues [I, 1 ] = Fscool. getmembership (I );
}

Chart. updatedataseries ( " Hot " , Coolvalues );

:

There is also a special membership function: singletonfunction. It is only used for classical values.

 
Singletonfunction membershipfunction =NewSingletonfunction (20);

 

Download: http://www.ctdisk.com/file/4466992

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.