Table of Contents
Back

Creating the label file

In order to extract rules from the network you must first create a label file.

Press the Label button.

This label file can now be saved and then modified.



Back

Saving the label file

Select Save As Label File from the Extract Rules menu.

Here you are able to choose what directory you want to save your label file in, and specify the name of the file.

The convention for the file extension of label files is *.lab.

The only restriction is that the path cannot contain a ) .



Back

Viewing the label file

You can press the View button view to view your label file, or select View Label File from the Extract Rules menu.

Note: You need to associate files of type *.lab with a text editor in Windows Explorer in order to view the files through the FuzzyCOPE GUI.

Below is an example of a label file that has been generated by FuNN.

[FuNNLabels]

[StructureInfo]

[Inputs = 4] /*Number of inputs to the network*/
[InputMF]
[Input=0 MF=3 ]
/*the input and the number of membership functions that it has*/
[Input=1 MF=3 ]
[Input=2 MF=3 ]
[Input=3 MF=3 ]
[~InputMF]

[Outputs = 3] /*Number of outputs from the network*/
[OutputMF]
[Output=0 MF=2 ]
/*The outputs and their number of membership functions*/
[Output=1 MF=2 ]
[Output=2 MF=2 ]
[~OutputMF]

[~StructureInfo]

[InputLabels] /*The inputs and their corresponding labels - these can be modified*/
[Input=0 Label=InputA ]
[Input=1 Label=InputB ]
[Input=2 Label=InputC ]
[Input=3 Label=InputD ]
[~InputLabels]

[InputMFLabels] /*The condition elements and their corresponding labels- these can be modified*/
[Condition=0 Label=A ]
[Condition=1 Label=B ]
[Condition=2 Label=C ]
[Condition=3 Label=A ]
[Condition=4 Label=B ]
[Condition=5 Label=C ]
[Condition=6 Label=A ]
[Condition=7 Label=B ]
[Condition=8 Label=C ]
[Condition=9 Label=A ]
[Condition=10 Label=B ]
[Condition=11 Label=C ]
[~InputMFLabels]

[OutputLabels] /*The outputs and their corresponding labels- these can be modified*/
[Output=0 Label=OutputA ]
[Output=1 Label=OutputB ]
[Output=2 Label=OutputC ]
[~OutputLabels]

[OutputMFLabels] /*The action elements and their corresponding labels- these can be modified*/
[Action=0 Label=A ]
[Action=1 Label=B ]
[Action=2 Label=A ]
[Action=3 Label=B ]
[Action=4 Label=A ]
[Action=5 Label=B ]
[~OutputMFLabels]

[~FuNNLabels]



Back

Modifying the label file

When you create the label file the inputs, conditions, outputs and actions are given generic names-See figure 1 below. Therefore, before you extract the rules you may want to modify the label file and give the inputs etc more meaningful labels-See figure 2 below.

To do this open your label file in a text editor.

Modify:
InputLabels: to represent your input variable names
InputMFLabels: to represent the membership functions of your inputs
OutputLabels: to represent your output variable names
OutputMFLabels: to represent the membership functions of your outputs.

There are some restrictions on what the labels in the label file can contain.
They cannot contain:

  • Spaces, or
  • Special Characters (especially not brackets [ ] and comment characters */ )

    Once you have modified your label file you should save it and return to FuNN.

    Open the modified label file by pressing the Open button open or by selecting Load Label File from the Extract Rules menu.

    You can now extract the rules.

    FIGURE 1. Label file generated by FuNN

    [FuNNLabels]
    [StructureInfo]
    [Inputs=2]
    [InputMF]
    [Input=0 MF=3]
    [Input=1 MF=3]
    [~InputMF]
    [Outputs=3]
    [OutputMF]
    [Output=0 MF=2]
    [Output=1 MF=2]
    [Output=2 MF=2]
    [~OutputMF]
    [~StructureInfo]
    [InputLabels]
    [Input=0 Label=InputA]
    [Input=1 Label=InputB]
    [~InputLabels]
    [InputMFLabels]
    [Condition=0 Label=A]
    [Condition=1 Label=B]
    [Condition=2 Label=C]
    [Condition=3 Label=A]
    [Condition=4 Label=B]
    [Condition=5 Label=C]
    [~InputMFLabels]
    [OutputLabels]
    [Output=0 Label=OutputA]
    [Output=1 Label=OutputB]
    [Output=2 Label=OutputC]
    [~OutputLabels]
    [OutputMFLabels]
    [Action=0 Label=A]
    [Action=1 Label=B]
    [Action=2 Label=A]
    [Action=3 Label=B]
    [Action=4 Label=A]
    [Action=5 Label=B]
    [~OutputMFLabels]
    [~FuNNLabels]

    FIGURE 2. Modified label file

    [FuNNLabels]
    [StructureInfo]
    [Inputs=2]
    [InputMF]
    [Input=0 MF=3]
    [Input=1 MF=3]
    [~InputMF]
    [Outputs=3]
    [OutputMF]
    [Output=0 MF=2]
    [Output=1 MF=2]
    [Output=2 MF=2]
    [~OutputMF]
    [~StructureInfo]
    [InputLabels]
    [Input=0 Label=SepalLength]
    [Input=1 Label=SepalWidth]
    [~InputLabels]
    [InputMFLabels]
    [Condition=0 Label=Small]
    [Condition=1 Label=Medium]
    [Condition=2 Label=Large]
    [Condition=3 Label=Small]
    [Condition=4 Label=Medium]
    [Condition=5 Label=Large]
    [~InputMFLabels]
    [OutputLabels]
    [Output=0 Label=Setosa]
    [Output=1 Label=Versicolor]
    [Output=2 Label=Verginica]
    [~OutputLabels]
    [OutputMFLabels]
    [Action=0 Label=Low]
    [Action=1 Label=High]
    [Action=2 Label=Low]
    [Action=3 Label=High]
    [Action=4 Label=Low]
    [Action=5 Label=High]
    [~OutputMFLabels]
    [~FuNNLabels]





    Back

    Extracting rules

    You first need to set the threshold values.

    These values specify the threshold for including the connections in the rules.

    A connection that has a weight value that is less than the threshold value will not be included in the rules.

    Once you have set the threshold values press the Extract Rules button, and save the rule file.



    Back

    Saving the rule file

    Select Save As Rule File from the Extract Rules menu.

    Here you are able to choose what directory you want to save your rule file in, and specify the name of the file.

    The convention for the file extension of label files is *.rul.

    The only restriction is that the path cannot contain a ) .



    Back

    Viewing the rule file

    You can press the view button view to view your rule file, or select View Rule File from the Extract Rules menu.

    Note: You need to associate files of type *.rul with a text editor in Windows Explorer in order to view the files through the FuzzyCOPE GUI.

    Below is an example of a rule file that has been extracted from a FuNN using a modified label file.

    [FormatVersion = 1.0]/* This is a standard version number. Any value larger than 1.0 will not work*/

    [FuzzyRules]
    [RuleType = RENet]

    [MFList] /*Membership Functions list*/

    [MFListInfo]
    [VariablesRepresented = 4]
    [ListName = Inputs]
    /*List name - This is the Input Membership Functions list*/
    [~MFListInfo]

    [MFSet] /*There is one Membership Function Set for each input*/

    [MFSetInfo]
    [Name=SepalLength Index=0 Type=Triangular ]
    /*Input Name (Label taken from modified label file)*/
    /*Number of the input (starts at 0)*/
    /*Type of Membership Function can be LeftShoulderedTriangular, Triangular, or RightShoulderedTriangular (see Diagram 1)*/
    [LowerBound=0.0000000 UpperBound=1.0000000 ] /*Universe of discourse for this set of membership functions*/
    [NumberOfMF = 3] /*Number of Membership Functions*/
    [~MFSetInfo]

    [MF] /*Details Each Membership Function is detailed*/
    [Name=Small Index=0 Type=LeftShoulderedTriangular ]
    [Centre=0.0000000 RightBound=0.5000000 ]
    /*Bounds of this Membership Function within the universe of discourse*/
    /*LeftShoulderedTriangular MF has Center and RightBounds*/
    /*Triangular MF has LeftBound, Center, and RightBounds*/
    /*RightShoulderedTriangular MF has LeftBound and Center*/
    [~MF]

    [MF]
    [Name=Medium Index=1 Type=Triangular ]
    [LeftBound=0.0000000 Centre=0.5000000 RightBound=1.0000000 ]
    [~MF]

    [MF]
    [Name=Large Index=2 Type=RightShoulderedTriangular ]
    [LeftBound=0.5000000 Centre=1.0000000 ]
    [~MF]

    [~MFSet] /*End of the first MF set for the first input*/

    [MFSet]

    [MFSetInfo]
    [Name=SepalWidth Index=1 Type=Triangular ]
    [LowerBound=0.0000000 UpperBound=1.0000000 ]
    [NumberOfMF = 3]
    [~MFSetInfo]

    [MF]
    [Name=Small Index=0 Type=LeftShoulderedTriangular ]
    [Centre=0.0000000 RightBound=0.5000000 ]
    [~MF]

    [MF]
    [Name=Medium Index=1 Type=Triangular ]
    [LeftBound=0.0000000 Centre=0.5000000 RightBound=1.0000000 ]
    [~MF]

    [MF]
    [Name=Large Index=2 Type=RightShoulderedTriangular ]
    [LeftBound=0.5000000 Centre=1.0000000 ]
    [~MF]

    [~MFSet]

    [MFSet]

    [MFSetInfo]
    [Name=PetalLength Index=2 Type=Triangular ]
    [LowerBound=0.0000000 UpperBound=1.0000000 ]
    [NumberOfMF = 3]
    [~MFSetInfo]

    [MF]
    [Name=Small Index=0 Type=LeftShoulderedTriangular ]
    [Centre=0.0000000 RightBound=0.5000000 ]
    [~MF]

    [MF]
    [Name=Medium Index=1 Type=Triangular ]
    [LeftBound=0.0000000 Centre=0.5000000 RightBound=1.0000000 ]
    [~MF]

    [MF]
    [Name=Large Index=2 Type=RightShoulderedTriangular ]
    [LeftBound=0.5000000 Centre=1.0000000 ]
    [~MF]

    [~MFSet]

    [MFSet]

    [MFSetInfo]
    [Name=PetalWidth Index=3 Type=Triangular ]
    [LowerBound=0.0000000 UpperBound=1.0000000 ]
    [NumberOfMF = 3]
    [~MFSetInfo]

    [MF]
    [Name=Small Index=0 Type=LeftShoulderedTriangular ]
    [Centre=0.0000000 RightBound=0.5000000 ]
    [~MF]

    [MF]
    [Name=Medium Index=1 Type=Triangular ]
    [LeftBound=0.0000000 Centre=0.5000000 RightBound=1.0000000 ]
    [~MF]

    [MF]
    [Name=Large Index=2 Type=RightShoulderedTriangular ]
    [LeftBound=0.5000000 Centre=1.0000000 ]
    [~MF]

    [~MFSet]

    [~MFList] /*End the Input Membership Functions List*/

    [MFList] /*Membership Functions list*/

    [MFListInfo]
    [VariablesRepresented = 3]
    [ListName = Outputs]
    /*List name - This is the Input Membership Functions list*/
    [~MFListInfo]

    [MFSet] /*There is one Membership Function Set for each output*/

    [MFSetInfo]
    [Name=IrisSetosa Index=0 Type=Triangular ]
    [LowerBound=0.0000000 UpperBound=1.0000000 ]
    [NumberOfMF = 2]
    [~MFSetInfo]

    [MF]
    [Name=Small Index=0 Type=LeftShoulderedTriangular ]
    [Centre=0.0000000 RightBound=1.0000000 ]
    [~MF]

    [MF]
    [Name=Large Index=1 Type=RightShoulderedTriangular ]
    [LeftBound=0.0000000 Centre=1.0000000 ]
    [~MF]

    [~MFSet]

    [MFSet]

    [MFSetInfo]
    [Name=IrisVersicolor Index=1 Type=Triangular ]
    [LowerBound=0.0000000 UpperBound=1.0000000 ]
    [NumberOfMF = 2]
    [~MFSetInfo]

    [MF]
    [Name=Small Index=0 Type=LeftShoulderedTriangular ]
    [Centre=0.0000000 RightBound=1.0000000 ]
    [~MF]

    [MF]
    [Name=Large Index=1 Type=RightShoulderedTriangular ]
    [LeftBound=0.0000000 Centre=1.0000000 ]
    [~MF]

    [~MFSet]

    [MFSet]

    [MFSetInfo]
    [Name=IrisVirginica Index=2 Type=Triangular ]
    [LowerBound=0.0000000 UpperBound=1.0000000 ]
    [NumberOfMF = 2]
    [~MFSetInfo]

    [MF]
    [Name=Small Index=0 Type=LeftShoulderedTriangular ]
    [Centre=0.0000000 RightBound=1.0000000 ]
    [~MF]

    [MF]
    [Name=Large Index=1 Type=RightShoulderedTriangular ]
    [LeftBound=0.0000000 Centre=1.0000000 ]
    [~MF]

    [~MFSet]

    [~MFList]

    [RuleList] /*Fuzzy Rule List*/
    /*In this example there are only 4 rules in the rule list. There could be more or less depending on the threshold values used when extracting the rules. Here the thresholds in and out were set at 1.0, but a smaller value would yield more rules, and a larger value less rules.*/
    if <SepalLength is Small 2.93705> and <SepalWidth is Small 4.46857> and <PetalLength is Large 9.13099> and <PetalWidth is Large 9.97832>
    then <IrisSetosa is Small 3.49527> and <IrisVersicolor is Small 10.224> and <IrisVirginica is Large 8.59811>

    if <SepalLength is Small 1.39414> and <SepalWidth is Large 1.07644> and <PetalLength is Small 3.35307> and <PetalWidth is Small 2.45576>
    then <IrisSetosa is Large 3.1365> and <IrisVersicolor is Small 5.44303> and <IrisVirginica is Small 1.7172>

    if <PetalLength is Small 2.93755> and <PetalWidth is Medium 2.27966>
    then <IrisSetosa is Large 1.58116> and <IrisVersicolor is Large 1.51761> and <IrisVirginica is Small 5.59218>

    if <PetalLength is Medium 2.22535> and <PetalWidth is Medium 3.33223>
    then <IrisSetosa is Small 6.05011> and <IrisVersicolor is Large 4.33953> and <IrisVirginica is Small 1.10254>

    [~RuleList]

    [~FuzzyRules]

    Membership Functions
    Diagram 1:Examples of each of the types of Membership Function Graphs.


    This page is maintained by Melanie Middlemiss mmiddlemiss@infoscience.otago.ac.nz
    Last modified on: 15/2/99.