Weka - MultilayerPerceptron output in Excel

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Weka - MultilayerPerceptron output in Excel

achar
Hello again,

I am using MultilayerPerceptron to create a NN, which is trained
successfully according to WEKA. I am trying to replicate the results in
Excel. I made a simple parser of the output, but I cannot get the results
straight. The output does not make any sense. Any insight would be welcome.

I suppose the sigmoid function is defined as sigmoid(w, x, b) = 1 / (1 +
exp(-(<w,x>-b))), with b being the threshold. I have tried with (+/-) b but
to no avail. I also read somewhere that the sigmoid in WEKA is defined as
   If (value < -45) Then {
     value = 0;
   }
   ElseIf (value > 45) Then {
     value = 1;
   }
   Else {
     value = 1 / (1 + Math.Exp(-value));
   }  

Also, I translate the linear node as <w,x>+b

A simple example:

Suppose I have 1 hidden layer of 5 nodes, the output I get is:

=== Run information ===

Scheme:       weka.classifiers.functions.MultilayerPerceptronCS -L 0.3 -M
0.2 -N 1000 -V 0 -S 0 -E 20 -H 5
Relation:     data
Instances:    4026
Attributes:   6
              Number of Storeys
              Number of Spans
              Length of Spans (m)
              Opening percentage (%)
              Masonry wall Stiffeness Et (x10^5 kN/m)
              Period (Sec)
Test mode:    10-fold cross-validation

=== Classifier model (full training set) ===

Linear Node 0
    Inputs    Weights
    Threshold    1.479515662214628
    Node 1    -1.2500813145671659
    Node 2    -1.1936223860947242
    Node 3    -1.0322755928454377
    Node 4    0.6873819829338501
    Node 5    -0.8755940293144294
Sigmoid Node 1
    Inputs    Weights
    Threshold    -0.020779798699673828
    Attrib Number of Storeys    -0.47751964434474686
    Attrib Number of Spans    0.051982817435324694
    Attrib Length of Spans (m)    0.11541540106371614
    Attrib Opening percentage (%)    -2.1530097993944937
    Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    0.5824263986660082
Sigmoid Node 2
    Inputs    Weights
    Threshold    3.153528808536817
    Attrib Number of Storeys    -1.274000354409299
    Attrib Number of Spans    -0.2074191313850551
    Attrib Length of Spans (m)    -0.8179982590889109
    Attrib Opening percentage (%)    -1.356192955914052
    Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    -0.25363472958936506
Sigmoid Node 3
    Inputs    Weights
    Threshold    -1.7602140190613385
    Attrib Number of Storeys    -0.8856009305882884
    Attrib Number of Spans    0.27343819917084683
    Attrib Length of Spans (m)    -0.4635294706291094
    Attrib Opening percentage (%)    2.117897752537026
    Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    -0.6032425283206477
Sigmoid Node 4
    Inputs    Weights
    Threshold    -1.8548729118511484
    Attrib Number of Storeys    1.1623791972607342
    Attrib Number of Spans    -0.36297427587015374
    Attrib Length of Spans (m)    0.5762798462081734
    Attrib Opening percentage (%)    0.5488391987947177
    Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    -1.2120904391073823
Sigmoid Node 5
    Inputs    Weights
    Threshold    -2.381202855776649
    Attrib Number of Storeys    -1.232612057937638
    Attrib Number of Spans    -0.4122916890498481
    Attrib Length of Spans (m)    0.5818135690013081
    Attrib Opening percentage (%)    0.7440217904363292
    Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    -0.13724414628886286
Class
    Input
    Node 0


Time taken to build model: 4.44 seconds

=== Cross-validation ===
=== Summary ===

Correlation coefficient                  0.9936
Mean absolute error                      0.0726
Root mean squared error                  0.0924
Relative absolute error                 11.2192 %
Root relative squared error             11.7692 %
Total Number of Instances             4026    

The attributes are stored in Columns A to E:
              Number of Storeys -> A2
              Number of Spans -> B2
              Length of Spans (m) -> C2
              Opening percentage (%) -> D2
              Masonry wall Stiffeness Et (x10^5 kN/m)->E2

Cells to hold the values of the nodes:
Linear Node 0 (class) -> Z2
Sigmoid Node 1 -> AA2
Sigmoid Node 2 -> AB2
Sigmoid Node 3 -> AC2
Sigmoid Node 4 -> AD2
Sigmoid Node 5 -> AE2

In Z2 (Node
0):=+1.479515662214628-1.2500813145671659*AA2-1.1936223860947242*AB2-1.0322755928454377*AC2+0.6873819829338501*AD2-0.8755940293144294*AE2

In AA2 (Node 1):
=IF(+0.020779798699673828-0.47751964434474686*A2+0.051982817435324694*B2+0.11541540106371614*C2-2.1530097993944937*D2+0.5824263986660082*E2<-45,0,IF(+0.020779798699673828-0.47751964434474686*A2+0.051982817435324694*B2+0.11541540106371614*C2-2.1530097993944937*D2+0.5824263986660082*E2>45,1,1/(1+EXP(-(+0.020779798699673828-0.47751964434474686*A2+0.051982817435324694*B2+0.11541540106371614*C2-2.1530097993944937*D2+0.5824263986660082*E2)))))

In AB2(Node 2):
=IF(-3.153528808536817-1.274000354409299*A2-0.2074191313850551*B2-0.8179982590889109*C2-1.356192955914052*D2-0.25363472958936506*E2<-45,0,IF(-3.153528808536817-1.274000354409299*A2-0.2074191313850551*B2-0.8179982590889109*C2-1.356192955914052*D2-0.25363472958936506*E2>45,1,1/(1+EXP(-(-3.153528808536817-1.274000354409299*A2-0.2074191313850551*B2-0.8179982590889109*C2-1.356192955914052*D2-0.25363472958936506*E2)))))

In AC2(Node 3):
=IF(+1.7602140190613385-0.8856009305882884*A2+0.27343819917084683*B2-0.4635294706291094*C2+2.117897752537026*D2-0.6032425283206477*E2<-45,0,IF(+1.7602140190613385-0.8856009305882884*A2+0.27343819917084683*B2-0.4635294706291094*C2+2.117897752537026*D2-0.6032425283206477*E2>45,1,1/(1+EXP(-(+1.7602140190613385-0.8856009305882884*A2+0.27343819917084683*B2-0.4635294706291094*C2+2.117897752537026*D2-0.6032425283206477*E2)))))

In AD2(Node 4):
=IF(+1.8548729118511484+1.1623791972607342*A2-0.36297427587015374*B2+0.5762798462081734*C2+0.5488391987947177*D2-1.2120904391073823*E2<-45,0,IF(+1.8548729118511484+1.1623791972607342*A2-0.36297427587015374*B2+0.5762798462081734*C2+0.5488391987947177*D2-1.2120904391073823*E2>45,1,1/(1+EXP(-(+1.8548729118511484+1.1623791972607342*A2-0.36297427587015374*B2+0.5762798462081734*C2+0.5488391987947177*D2-1.2120904391073823*E2)))))

In AE2(Node 5):
=IF(+2.381202855776649-1.232612057937638*A2-0.4122916890498481*B2+0.5818135690013081*C2+0.7440217904363292*D2-0.13724414628886286*E2<-45,0,IF(+2.381202855776649-1.232612057937638*A2-0.4122916890498481*B2+0.5818135690013081*C2+0.7440217904363292*D2-0.13724414628886286*E2>45,1,1/(1+EXP(-(+2.381202855776649-1.232612057937638*A2-0.4122916890498481*B2+0.5818135690013081*C2+0.7440217904363292*D2-0.13724414628886286*E2)))))

TIA
 



--
Sent from: https://weka.8497.n7.nabble.com/
_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to: To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit
https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Weka - MultilayerPerceptron output in Excel

Kiran Deshmukh-2
Achar:

Input to every node is given by:

Netinput, X = b + ∑ Y(i)W(i), where b is the threshold, Y(i) is the output from the i-th input node, and W(i) is that node's weight.

Then , output from the node is given by its activation function.

For the Linear Node, activation function, f(X) = X,
For the Sigmoid, f(X) = 1/(1+exp(-X)).

In your case, the Node 0 is a Linear Node, and Nodes 1-5 are Sigmoid Nodes.

Important thing to remember is that in Weka, MultilayerPerceptron uses Normalized variables. Every variable is normalized by converting it to remain in the range of -1 to +1. So, vital information required is the minimum and maximum values of the attributes used in the training set.

You need to, first normalize the Input (values in A2, B2, C2, D2, and E2) using the corresponding minimum and maximum values using: Input(normalized) = 2*(Input-Min)/(Max-Min)-1.

Then, the output obtained (Z2) needs to be re-normalized using: Output(re-normalized) = (Max-Min)*(Output+1)/2+Output.

Hope this helps.

Regards,
Kiran



On 03/11/19, 4:48 PM, "achar" <[hidden email]> wrote:

    Hello again,

    I am using MultilayerPerceptron to create a NN, which is trained
    successfully according to WEKA. I am trying to replicate the results in
    Excel. I made a simple parser of the output, but I cannot get the results
    straight. The output does not make any sense. Any insight would be welcome.

    I suppose the sigmoid function is defined as sigmoid(w, x, b) = 1 / (1 +
    exp(-(<w,x>-b))), with b being the threshold. I have tried with (+/-) b but
    to no avail. I also read somewhere that the sigmoid in WEKA is defined as
       If (value < -45) Then {
         value = 0;
       }
       ElseIf (value > 45) Then {
         value = 1;
       }
       Else {
         value = 1 / (1 + Math.Exp(-value));
       }

    Also, I translate the linear node as <w,x>+b

    A simple example:

    Suppose I have 1 hidden layer of 5 nodes, the output I get is:

    === Run information ===

    Scheme:       weka.classifiers.functions.MultilayerPerceptronCS -L 0.3 -M
    0.2 -N 1000 -V 0 -S 0 -E 20 -H 5
    Relation:     data
    Instances:    4026
    Attributes:   6
                  Number of Storeys
                  Number of Spans
                  Length of Spans (m)
                  Opening percentage (%)
                  Masonry wall Stiffeness Et (x10^5 kN/m)
                  Period (Sec)
    Test mode:    10-fold cross-validation

    === Classifier model (full training set) ===

    Linear Node 0
        Inputs    Weights
        Threshold    1.479515662214628
        Node 1    -1.2500813145671659
        Node 2    -1.1936223860947242
        Node 3    -1.0322755928454377
        Node 4    0.6873819829338501
        Node 5    -0.8755940293144294
    Sigmoid Node 1
        Inputs    Weights
        Threshold    -0.020779798699673828
        Attrib Number of Storeys    -0.47751964434474686
        Attrib Number of Spans    0.051982817435324694
        Attrib Length of Spans (m)    0.11541540106371614
        Attrib Opening percentage (%)    -2.1530097993944937
        Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    0.5824263986660082
    Sigmoid Node 2
        Inputs    Weights
        Threshold    3.153528808536817
        Attrib Number of Storeys    -1.274000354409299
        Attrib Number of Spans    -0.2074191313850551
        Attrib Length of Spans (m)    -0.8179982590889109
        Attrib Opening percentage (%)    -1.356192955914052
        Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    -0.25363472958936506
    Sigmoid Node 3
        Inputs    Weights
        Threshold    -1.7602140190613385
        Attrib Number of Storeys    -0.8856009305882884
        Attrib Number of Spans    0.27343819917084683
        Attrib Length of Spans (m)    -0.4635294706291094
        Attrib Opening percentage (%)    2.117897752537026
        Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    -0.6032425283206477
    Sigmoid Node 4
        Inputs    Weights
        Threshold    -1.8548729118511484
        Attrib Number of Storeys    1.1623791972607342
        Attrib Number of Spans    -0.36297427587015374
        Attrib Length of Spans (m)    0.5762798462081734
        Attrib Opening percentage (%)    0.5488391987947177
        Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    -1.2120904391073823
    Sigmoid Node 5
        Inputs    Weights
        Threshold    -2.381202855776649
        Attrib Number of Storeys    -1.232612057937638
        Attrib Number of Spans    -0.4122916890498481
        Attrib Length of Spans (m)    0.5818135690013081
        Attrib Opening percentage (%)    0.7440217904363292
        Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    -0.13724414628886286
    Class
        Input
        Node 0


    Time taken to build model: 4.44 seconds

    === Cross-validation ===
    === Summary ===

    Correlation coefficient                  0.9936
    Mean absolute error                      0.0726
    Root mean squared error                  0.0924
    Relative absolute error                 11.2192 %
    Root relative squared error             11.7692 %
    Total Number of Instances             4026

    The attributes are stored in Columns A to E:
                  Number of Storeys -> A2
                  Number of Spans -> B2
                  Length of Spans (m) -> C2
                  Opening percentage (%) -> D2
                  Masonry wall Stiffeness Et (x10^5 kN/m)->E2

    Cells to hold the values of the nodes:
    Linear Node 0 (class) -> Z2
    Sigmoid Node 1 -> AA2
    Sigmoid Node 2 -> AB2
    Sigmoid Node 3 -> AC2
    Sigmoid Node 4 -> AD2
    Sigmoid Node 5 -> AE2

    In Z2 (Node
    0):=+1.479515662214628-1.2500813145671659*AA2-1.1936223860947242*AB2-1.0322755928454377*AC2+0.6873819829338501*AD2-0.8755940293144294*AE2

    In AA2 (Node 1):
    =IF(+0.020779798699673828-0.47751964434474686*A2+0.051982817435324694*B2+0.11541540106371614*C2-2.1530097993944937*D2+0.5824263986660082*E2<-45,0,IF(+0.020779798699673828-0.47751964434474686*A2+0.051982817435324694*B2+0.11541540106371614*C2-2.1530097993944937*D2+0.5824263986660082*E2>45,1,1/(1+EXP(-(+0.020779798699673828-0.47751964434474686*A2+0.051982817435324694*B2+0.11541540106371614*C2-2.1530097993944937*D2+0.5824263986660082*E2)))))

    In AB2(Node 2):
    =IF(-3.153528808536817-1.274000354409299*A2-0.2074191313850551*B2-0.8179982590889109*C2-1.356192955914052*D2-0.25363472958936506*E2<-45,0,IF(-3.153528808536817-1.274000354409299*A2-0.2074191313850551*B2-0.8179982590889109*C2-1.356192955914052*D2-0.25363472958936506*E2>45,1,1/(1+EXP(-(-3.153528808536817-1.274000354409299*A2-0.2074191313850551*B2-0.8179982590889109*C2-1.356192955914052*D2-0.25363472958936506*E2)))))

    In AC2(Node 3):
    =IF(+1.7602140190613385-0.8856009305882884*A2+0.27343819917084683*B2-0.4635294706291094*C2+2.117897752537026*D2-0.6032425283206477*E2<-45,0,IF(+1.7602140190613385-0.8856009305882884*A2+0.27343819917084683*B2-0.4635294706291094*C2+2.117897752537026*D2-0.6032425283206477*E2>45,1,1/(1+EXP(-(+1.7602140190613385-0.8856009305882884*A2+0.27343819917084683*B2-0.4635294706291094*C2+2.117897752537026*D2-0.6032425283206477*E2)))))

    In AD2(Node 4):
    =IF(+1.8548729118511484+1.1623791972607342*A2-0.36297427587015374*B2+0.5762798462081734*C2+0.5488391987947177*D2-1.2120904391073823*E2<-45,0,IF(+1.8548729118511484+1.1623791972607342*A2-0.36297427587015374*B2+0.5762798462081734*C2+0.5488391987947177*D2-1.2120904391073823*E2>45,1,1/(1+EXP(-(+1.8548729118511484+1.1623791972607342*A2-0.36297427587015374*B2+0.5762798462081734*C2+0.5488391987947177*D2-1.2120904391073823*E2)))))

    In AE2(Node 5):
    =IF(+2.381202855776649-1.232612057937638*A2-0.4122916890498481*B2+0.5818135690013081*C2+0.7440217904363292*D2-0.13724414628886286*E2<-45,0,IF(+2.381202855776649-1.232612057937638*A2-0.4122916890498481*B2+0.5818135690013081*C2+0.7440217904363292*D2-0.13724414628886286*E2>45,1,1/(1+EXP(-(+2.381202855776649-1.232612057937638*A2-0.4122916890498481*B2+0.5818135690013081*C2+0.7440217904363292*D2-0.13724414628886286*E2)))))

    TIA




    --
    Sent from: https://weka.8497.n7.nabble.com/
    _______________________________________________
    Wekalist mailing list -- [hidden email]
    Send posts to: To unsubscribe send an email to [hidden email]
    To subscribe, unsubscribe, etc., visit
    https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
    List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
    All our e-mail addresses have migrated from domain sonagroup.com to domain sonacomstar.com While we would continue to receive mails at both domains for some time, we request you to update your address book to our new domain.

    Disclaimer: The contents of this E-mail (including the contents of the enclosure/(s) or attachment/(s) if any) are privileged and confidential and should not be disclosed to, used by or copied in any manner by anyone other than the intended addressee/(s). If this E-mail (including the enclosure/(s) or attachment/(s) if any) has been received in error, please advise the sender immediately and delete it from your system. The views expressed in this E-mail message (including the enclosure/(s) or attachment/(s) if any) are those of the individual sender.


All our e-mail addresses have migrated from domain sonagroup.com to domain sonacomstar.com While we would continue to receive mails at both domains for some time, we request you to update your address book to our new domain.

Disclaimer: The contents of this E-mail (including the contents of the enclosure/(s) or attachment/(s) if any) are privileged and confidential and should not be disclosed to, used by or copied in any manner by anyone other than the intended addressee/(s). If this E-mail (including the enclosure/(s) or attachment/(s) if any) has been received in error, please advise the sender immediately and delete it from your system. The views expressed in this E-mail message (including the enclosure/(s) or attachment/(s) if any) are those of the individual sender.
_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to: To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit
https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Weka - MultilayerPerceptron output in Excel

Kiran Deshmukh-2
I am sorry, there was a typo in my earlier response.

The formula for re-normalizing is: : Output(re-normalized) = (Max-Min)*(Output+1)/2+Min.

Please note the mistake. Apologies for the typo!



On 05/11/19, 12:51 AM, "Kiran Deshmukh" <[hidden email]> wrote:

    Achar:

    Input to every node is given by:

    Netinput, X = b + ∑ Y(i)W(i), where b is the threshold, Y(i) is the output from the i-th input node, and W(i) is that node's weight.

    Then , output from the node is given by its activation function.

    For the Linear Node, activation function, f(X) = X,
    For the Sigmoid, f(X) = 1/(1+exp(-X)).

    In your case, the Node 0 is a Linear Node, and Nodes 1-5 are Sigmoid Nodes.

    Important thing to remember is that in Weka, MultilayerPerceptron uses Normalized variables. Every variable is normalized by converting it to remain in the range of -1 to +1. So, vital information required is the minimum and maximum values of the attributes used in the training set.

    You need to, first normalize the Input (values in A2, B2, C2, D2, and E2) using the corresponding minimum and maximum values using: Input(normalized) = 2*(Input-Min)/(Max-Min)-1.

    Then, the output obtained (Z2) needs to be re-normalized using: Output(re-normalized) = (Max-Min)*(Output+1)/2+Output.

    Hope this helps.

    Regards,
    Kiran



    On 03/11/19, 4:48 PM, "achar" <[hidden email]> wrote:

        Hello again,

        I am using MultilayerPerceptron to create a NN, which is trained
        successfully according to WEKA. I am trying to replicate the results in
        Excel. I made a simple parser of the output, but I cannot get the results
        straight. The output does not make any sense. Any insight would be welcome.

        I suppose the sigmoid function is defined as sigmoid(w, x, b) = 1 / (1 +
        exp(-(<w,x>-b))), with b being the threshold. I have tried with (+/-) b but
        to no avail. I also read somewhere that the sigmoid in WEKA is defined as
           If (value < -45) Then {
             value = 0;
           }
           ElseIf (value > 45) Then {
             value = 1;
           }
           Else {
             value = 1 / (1 + Math.Exp(-value));
           }

        Also, I translate the linear node as <w,x>+b

        A simple example:

        Suppose I have 1 hidden layer of 5 nodes, the output I get is:

        === Run information ===

        Scheme:       weka.classifiers.functions.MultilayerPerceptronCS -L 0.3 -M
        0.2 -N 1000 -V 0 -S 0 -E 20 -H 5
        Relation:     data
        Instances:    4026
        Attributes:   6
                      Number of Storeys
                      Number of Spans
                      Length of Spans (m)
                      Opening percentage (%)
                      Masonry wall Stiffeness Et (x10^5 kN/m)
                      Period (Sec)
        Test mode:    10-fold cross-validation

        === Classifier model (full training set) ===

        Linear Node 0
            Inputs    Weights
            Threshold    1.479515662214628
            Node 1    -1.2500813145671659
            Node 2    -1.1936223860947242
            Node 3    -1.0322755928454377
            Node 4    0.6873819829338501
            Node 5    -0.8755940293144294
        Sigmoid Node 1
            Inputs    Weights
            Threshold    -0.020779798699673828
            Attrib Number of Storeys    -0.47751964434474686
            Attrib Number of Spans    0.051982817435324694
            Attrib Length of Spans (m)    0.11541540106371614
            Attrib Opening percentage (%)    -2.1530097993944937
            Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    0.5824263986660082
        Sigmoid Node 2
            Inputs    Weights
            Threshold    3.153528808536817
            Attrib Number of Storeys    -1.274000354409299
            Attrib Number of Spans    -0.2074191313850551
            Attrib Length of Spans (m)    -0.8179982590889109
            Attrib Opening percentage (%)    -1.356192955914052
            Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    -0.25363472958936506
        Sigmoid Node 3
            Inputs    Weights
            Threshold    -1.7602140190613385
            Attrib Number of Storeys    -0.8856009305882884
            Attrib Number of Spans    0.27343819917084683
            Attrib Length of Spans (m)    -0.4635294706291094
            Attrib Opening percentage (%)    2.117897752537026
            Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    -0.6032425283206477
        Sigmoid Node 4
            Inputs    Weights
            Threshold    -1.8548729118511484
            Attrib Number of Storeys    1.1623791972607342
            Attrib Number of Spans    -0.36297427587015374
            Attrib Length of Spans (m)    0.5762798462081734
            Attrib Opening percentage (%)    0.5488391987947177
            Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    -1.2120904391073823
        Sigmoid Node 5
            Inputs    Weights
            Threshold    -2.381202855776649
            Attrib Number of Storeys    -1.232612057937638
            Attrib Number of Spans    -0.4122916890498481
            Attrib Length of Spans (m)    0.5818135690013081
            Attrib Opening percentage (%)    0.7440217904363292
            Attrib Masonry wall Stiffeness Et (x10^5 kN/m)    -0.13724414628886286
        Class
            Input
            Node 0


        Time taken to build model: 4.44 seconds

        === Cross-validation ===
        === Summary ===

        Correlation coefficient                  0.9936
        Mean absolute error                      0.0726
        Root mean squared error                  0.0924
        Relative absolute error                 11.2192 %
        Root relative squared error             11.7692 %
        Total Number of Instances             4026

        The attributes are stored in Columns A to E:
                      Number of Storeys -> A2
                      Number of Spans -> B2
                      Length of Spans (m) -> C2
                      Opening percentage (%) -> D2
                      Masonry wall Stiffeness Et (x10^5 kN/m)->E2

        Cells to hold the values of the nodes:
        Linear Node 0 (class) -> Z2
        Sigmoid Node 1 -> AA2
        Sigmoid Node 2 -> AB2
        Sigmoid Node 3 -> AC2
        Sigmoid Node 4 -> AD2
        Sigmoid Node 5 -> AE2

        In Z2 (Node
        0):=+1.479515662214628-1.2500813145671659*AA2-1.1936223860947242*AB2-1.0322755928454377*AC2+0.6873819829338501*AD2-0.8755940293144294*AE2

        In AA2 (Node 1):
        =IF(+0.020779798699673828-0.47751964434474686*A2+0.051982817435324694*B2+0.11541540106371614*C2-2.1530097993944937*D2+0.5824263986660082*E2<-45,0,IF(+0.020779798699673828-0.47751964434474686*A2+0.051982817435324694*B2+0.11541540106371614*C2-2.1530097993944937*D2+0.5824263986660082*E2>45,1,1/(1+EXP(-(+0.020779798699673828-0.47751964434474686*A2+0.051982817435324694*B2+0.11541540106371614*C2-2.1530097993944937*D2+0.5824263986660082*E2)))))

        In AB2(Node 2):
        =IF(-3.153528808536817-1.274000354409299*A2-0.2074191313850551*B2-0.8179982590889109*C2-1.356192955914052*D2-0.25363472958936506*E2<-45,0,IF(-3.153528808536817-1.274000354409299*A2-0.2074191313850551*B2-0.8179982590889109*C2-1.356192955914052*D2-0.25363472958936506*E2>45,1,1/(1+EXP(-(-3.153528808536817-1.274000354409299*A2-0.2074191313850551*B2-0.8179982590889109*C2-1.356192955914052*D2-0.25363472958936506*E2)))))

        In AC2(Node 3):
        =IF(+1.7602140190613385-0.8856009305882884*A2+0.27343819917084683*B2-0.4635294706291094*C2+2.117897752537026*D2-0.6032425283206477*E2<-45,0,IF(+1.7602140190613385-0.8856009305882884*A2+0.27343819917084683*B2-0.4635294706291094*C2+2.117897752537026*D2-0.6032425283206477*E2>45,1,1/(1+EXP(-(+1.7602140190613385-0.8856009305882884*A2+0.27343819917084683*B2-0.4635294706291094*C2+2.117897752537026*D2-0.6032425283206477*E2)))))

        In AD2(Node 4):
        =IF(+1.8548729118511484+1.1623791972607342*A2-0.36297427587015374*B2+0.5762798462081734*C2+0.5488391987947177*D2-1.2120904391073823*E2<-45,0,IF(+1.8548729118511484+1.1623791972607342*A2-0.36297427587015374*B2+0.5762798462081734*C2+0.5488391987947177*D2-1.2120904391073823*E2>45,1,1/(1+EXP(-(+1.8548729118511484+1.1623791972607342*A2-0.36297427587015374*B2+0.5762798462081734*C2+0.5488391987947177*D2-1.2120904391073823*E2)))))

        In AE2(Node 5):
        =IF(+2.381202855776649-1.232612057937638*A2-0.4122916890498481*B2+0.5818135690013081*C2+0.7440217904363292*D2-0.13724414628886286*E2<-45,0,IF(+2.381202855776649-1.232612057937638*A2-0.4122916890498481*B2+0.5818135690013081*C2+0.7440217904363292*D2-0.13724414628886286*E2>45,1,1/(1+EXP(-(+2.381202855776649-1.232612057937638*A2-0.4122916890498481*B2+0.5818135690013081*C2+0.7440217904363292*D2-0.13724414628886286*E2)))))

        TIA




        --
        Sent from: https://weka.8497.n7.nabble.com/
        _______________________________________________
        Wekalist mailing list -- [hidden email]
        Send posts to: To unsubscribe send an email to [hidden email]
        To subscribe, unsubscribe, etc., visit
        https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
        List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
        All our e-mail addresses have migrated from domain sonagroup.com to domain sonacomstar.com While we would continue to receive mails at both domains for some time, we request you to update your address book to our new domain.

        Disclaimer: The contents of this E-mail (including the contents of the enclosure/(s) or attachment/(s) if any) are privileged and confidential and should not be disclosed to, used by or copied in any manner by anyone other than the intended addressee/(s). If this E-mail (including the enclosure/(s) or attachment/(s) if any) has been received in error, please advise the sender immediately and delete it from your system. The views expressed in this E-mail message (including the enclosure/(s) or attachment/(s) if any) are those of the individual sender.


    All our e-mail addresses have migrated from domain sonagroup.com to domain sonacomstar.com While we would continue to receive mails at both domains for some time, we request you to update your address book to our new domain.

    Disclaimer: The contents of this E-mail (including the contents of the enclosure/(s) or attachment/(s) if any) are privileged and confidential and should not be disclosed to, used by or copied in any manner by anyone other than the intended addressee/(s). If this E-mail (including the enclosure/(s) or attachment/(s) if any) has been received in error, please advise the sender immediately and delete it from your system. The views expressed in this E-mail message (including the enclosure/(s) or attachment/(s) if any) are those of the individual sender.
    _______________________________________________
    Wekalist mailing list -- [hidden email]
    Send posts to: To unsubscribe send an email to [hidden email]
    To subscribe, unsubscribe, etc., visit
    https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
    List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html


All our e-mail addresses have migrated from domain sonagroup.com to domain sonacomstar.com While we would continue to receive mails at both domains for some time, we request you to update your address book to our new domain.

Disclaimer: The contents of this E-mail (including the contents of the enclosure/(s) or attachment/(s) if any) are privileged and confidential and should not be disclosed to, used by or copied in any manner by anyone other than the intended addressee/(s). If this E-mail (including the enclosure/(s) or attachment/(s) if any) has been received in error, please advise the sender immediately and delete it from your system. The views expressed in this E-mail message (including the enclosure/(s) or attachment/(s) if any) are those of the individual sender.
_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to: To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit
https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html
Reply | Threaded
Open this post in threaded view
|

Re: Weka - MultilayerPerceptron output in Excel

Kiran Deshmukh-2
Hi!

A few years ago, I encountered the same problem while replicating the results of WEKA Multilayer Perceptron Neural Network (NN) in excel, and solved it by normalizing the inputs and 're-normalizing' the output.

To repeat:

 x_norm = 2 * (x - x_min)/(x_max - x_min) - 1    ---------(1)

[If you substitute, x = x_min in equation (1), you will get -1. If you substitute x=x_max, you will get +1.]

Conversely,

x = (x-norm + 1) * (x_max - x_min) / 2 + x_min    ---------(2)

In both the equations, x_min and x_max are the minimum and maximum values, respectively, of the parameter under consideration (an input to the NN, or an output of the NN) FROM THE TRAINING DATASET.

Unfortunately, the Model displayed by WEKA does not provide the minimum and maximum values. So, you need to refer to the entire TRAINING SET that was used to build the model, and find out minimum and maximum values of all the attributes [in your case, all the six: Number of Storeys, Number of Spans, Length of Spans (m), Opening percentage (%), Masonry wall Stiffeness Et (x10^5 kN/m), AND Period (Sec)]. You will use minimum and maximum values of the first five attributes to normalize the inputs to the NN, and Period (Sec) from the training dataset to 're-normalize' the output obtained from the NN.

So, NOT the values from the output column (-1.04288 and 0.95431, respectively), but the minimum and maximum values from the training data set.

Hope this helps.

--Kiran


On 09/11/19, 6:23 AM, "achar" <[hidden email]> wrote:

    Hello, and thanks for your help. I am certain that normalization was the
    reason I couldn't make it work. However I still do not get the results I
    expected.

    In the corrected re-normalization formula,

    "Output(re-normalized) = (Max-Min)*(Output+1)/2+Min"

    max and min refer to the output column (linear node 0)?

    The normalization of the input is correct. The output column before the
    re-normalization gives me a minimum value of -1.04288 and a maximum value of
    0.95431, if that is of help.

    TIA



    --
    Sent from: https://weka.8497.n7.nabble.com/
    _______________________________________________
    Wekalist mailing list -- [hidden email]
    Send posts to: To unsubscribe send an email to [hidden email]
    To subscribe, unsubscribe, etc., visit
    https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
    List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html


All our e-mail addresses have migrated from domain sonagroup.com to domain sonacomstar.com While we would continue to receive mails at both domains for some time, we request you to update your address book to our new domain.

Disclaimer: The contents of this E-mail (including the contents of the enclosure/(s) or attachment/(s) if any) are privileged and confidential and should not be disclosed to, used by or copied in any manner by anyone other than the intended addressee/(s). If this E-mail (including the enclosure/(s) or attachment/(s) if any) has been received in error, please advise the sender immediately and delete it from your system. The views expressed in this E-mail message (including the enclosure/(s) or attachment/(s) if any) are those of the individual sender.
_______________________________________________
Wekalist mailing list -- [hidden email]
Send posts to: To unsubscribe send an email to [hidden email]
To subscribe, unsubscribe, etc., visit
https://list.waikato.ac.nz/postorius/lists/wekalist.list.waikato.ac.nz
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html