<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Understand neural network output in EMiner (XOR problem) in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/Understand-neural-network-output-in-EMiner-XOR-problem/m-p/376676#M5603</link>
    <description>&lt;P&gt;Are you using the activation functions in your calculations? That's the only thing I can think that could be missing. &amp;nbsp;You can see the exact calculations that are being done in the score code if you open up the Results of the Neural Network node, then go to View&amp;gt;Scoring&amp;gt;SAS Code. &amp;nbsp;You will see something like this for the hidden units:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*** *************************;&lt;BR /&gt;*** Writing the Node H1 ;&lt;BR /&gt;*** *************************;&lt;BR /&gt;IF _DM_BAD EQ 0 THEN DO;&lt;BR /&gt; H11 = -1.52129446502195 * BAD0 ;&lt;BR /&gt; H12 = 0.79120505194756 * BAD0 ;&lt;BR /&gt; H13 = 0.57109362454256 * BAD0 ;&lt;BR /&gt; H11 = 0.17517854710157 + H11 ;&lt;BR /&gt; H12 = -1.44433268465385 + H12 ;&lt;BR /&gt; H13 = 0.45098528984172 + H13 ;&lt;BR /&gt; H11 = TANH(H11 );&lt;BR /&gt; H12 = TANH(H12 );&lt;BR /&gt; H13 = TANH(H13 );&lt;BR /&gt;END;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then for the posterior probabilities, code like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P_REASONHomeImp = 0.11560366817131 * H11 + 0.11890802193169 * H12&lt;BR /&gt; + -0.12101594764922 * H13 ;&lt;BR /&gt; P_REASONHomeImp = -0.97997241580015 + P_REASONHomeImp ;&lt;BR /&gt; P_REASONDebtCon = 0;&lt;BR /&gt; _MAX_ = MAX (P_REASONHomeImp , P_REASONDebtCon );&lt;BR /&gt; _SUM_ = 0.;&lt;BR /&gt; P_REASONHomeImp = EXP(P_REASONHomeImp - _MAX_);&lt;BR /&gt; _SUM_ = _SUM_ + P_REASONHomeImp ;&lt;BR /&gt; P_REASONDebtCon = EXP(P_REASONDebtCon - _MAX_);&lt;BR /&gt; _SUM_ = _SUM_ + P_REASONDebtCon ;&lt;BR /&gt; P_REASONHomeImp = P_REASONHomeImp / _SUM_;&lt;BR /&gt; P_REASONDebtCon = P_REASONDebtCon / _SUM_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Jul 2017 18:06:13 GMT</pubDate>
    <dc:creator>WendyCzika</dc:creator>
    <dc:date>2017-07-17T18:06:13Z</dc:date>
    <item>
      <title>Understand neural network output in EMiner (XOR problem)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Understand-neural-network-output-in-EMiner-XOR-problem/m-p/374878#M5585</link>
      <description>&lt;P&gt;&lt;EM&gt;Split this topic from this &lt;A href="https://communities.sas.com/t5/SAS-Data-Mining-and-Machine/Understand-neural-network-output-in-EMiner/m-p/305273" target="_self"&gt;solved question about neural network output&lt;/A&gt;.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I managed to see the predicted values for a given observation, &lt;A href="https://communities.sas.com/t5/SAS-Data-Mining-and-Machine/Understand-neural-network-output-in-EMiner/m-p/305273" target="_self"&gt;following the procedures detailed in this previous post&lt;/A&gt;. However, that predicted value&amp;nbsp;seems to be&amp;nbsp;different from what I calculated manually.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to learn the XOR problem, so I have 2 binary input Variables A and B, and&amp;nbsp;1 binary target y=0 if A=B, otherwise y=1. I created a single layer neural network that have 2 hidden nodes&amp;nbsp;and a bias node (see figure 1 for network settings, see figure&amp;nbsp;2 for structure). From the exported trianing data, I can see that all observations are predicted correctly. However,&amp;nbsp;I then&amp;nbsp;extracted the final weights of all the connections, and then proceed to try out all 4 combinations of A and B (see figure 2), but they all seems to predict y=1 which is obviously wrong. Did i do something wrong? Is this not how I am suppose to intepret the weights?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10246i9FF8C72FADAD3CEF/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="xor3.png" title="xor3.png" width="478" height="271" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10245i6191504890AD54CD/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="XOR2.png" title="XOR2.png" width="422" height="294" /&gt;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10242i025FBA2CF4C30869/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="XOR.png" title="XOR.png" /&gt;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/14064i6E64E178ABD42408/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="XOR.png" title="XOR.png" /&gt;</description>
      <pubDate>Tue, 11 Jul 2017 11:20:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Understand-neural-network-output-in-EMiner-XOR-problem/m-p/374878#M5585</guid>
      <dc:creator>AndrewVOA</dc:creator>
      <dc:date>2017-07-11T11:20:24Z</dc:date>
    </item>
    <item>
      <title>Re: Understand neural network output in EMiner (XOR problem)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Understand-neural-network-output-in-EMiner-XOR-problem/m-p/376676#M5603</link>
      <description>&lt;P&gt;Are you using the activation functions in your calculations? That's the only thing I can think that could be missing. &amp;nbsp;You can see the exact calculations that are being done in the score code if you open up the Results of the Neural Network node, then go to View&amp;gt;Scoring&amp;gt;SAS Code. &amp;nbsp;You will see something like this for the hidden units:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*** *************************;&lt;BR /&gt;*** Writing the Node H1 ;&lt;BR /&gt;*** *************************;&lt;BR /&gt;IF _DM_BAD EQ 0 THEN DO;&lt;BR /&gt; H11 = -1.52129446502195 * BAD0 ;&lt;BR /&gt; H12 = 0.79120505194756 * BAD0 ;&lt;BR /&gt; H13 = 0.57109362454256 * BAD0 ;&lt;BR /&gt; H11 = 0.17517854710157 + H11 ;&lt;BR /&gt; H12 = -1.44433268465385 + H12 ;&lt;BR /&gt; H13 = 0.45098528984172 + H13 ;&lt;BR /&gt; H11 = TANH(H11 );&lt;BR /&gt; H12 = TANH(H12 );&lt;BR /&gt; H13 = TANH(H13 );&lt;BR /&gt;END;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then for the posterior probabilities, code like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;P_REASONHomeImp = 0.11560366817131 * H11 + 0.11890802193169 * H12&lt;BR /&gt; + -0.12101594764922 * H13 ;&lt;BR /&gt; P_REASONHomeImp = -0.97997241580015 + P_REASONHomeImp ;&lt;BR /&gt; P_REASONDebtCon = 0;&lt;BR /&gt; _MAX_ = MAX (P_REASONHomeImp , P_REASONDebtCon );&lt;BR /&gt; _SUM_ = 0.;&lt;BR /&gt; P_REASONHomeImp = EXP(P_REASONHomeImp - _MAX_);&lt;BR /&gt; _SUM_ = _SUM_ + P_REASONHomeImp ;&lt;BR /&gt; P_REASONDebtCon = EXP(P_REASONDebtCon - _MAX_);&lt;BR /&gt; _SUM_ = _SUM_ + P_REASONDebtCon ;&lt;BR /&gt; P_REASONHomeImp = P_REASONHomeImp / _SUM_;&lt;BR /&gt; P_REASONDebtCon = P_REASONDebtCon / _SUM_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2017 18:06:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Understand-neural-network-output-in-EMiner-XOR-problem/m-p/376676#M5603</guid>
      <dc:creator>WendyCzika</dc:creator>
      <dc:date>2017-07-17T18:06:13Z</dc:date>
    </item>
  </channel>
</rss>

