<?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: plot graphical models from PROC HPBNET in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/plot-graphical-models-from-PROC-HPBNET/m-p/364890#M5447</link>
    <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/14512" target="_self"&gt;&lt;SPAN class="login-bold"&gt;WendyCzika,&lt;/SPAN&gt;&lt;/A&gt; could you favorably help me? I've tried to use the abovementioned SAS code for my bnet's visualization too - thank you very much! This is incredibly powerful instrument which I would like to upgrade and customize, but when I've started to learn "PATHDIAGRAM" block and it's options I've figured out that there is no information even on the official sites and blogs. All information I've found referred to the "PATHDIAGRAM" in PROC CALIS and PROC FACTOR, which has another structure. Could you share guides or topics you've read before for my more deep diving in programming and visualisation bnets?&lt;/P&gt;</description>
    <pubDate>Wed, 07 Jun 2017 10:23:35 GMT</pubDate>
    <dc:creator>Red_Fox</dc:creator>
    <dc:date>2017-06-07T10:23:35Z</dc:date>
    <item>
      <title>plot graphical models from PROC HPBNET</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/plot-graphical-models-from-PROC-HPBNET/m-p/344437#M5157</link>
      <description>&lt;P&gt;Dear SAS Communities,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do you plot graphical models from PROC HPBNET? Is there another graphical model proceedure that plots the model?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;acs&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Mar 2017 18:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/plot-graphical-models-from-PROC-HPBNET/m-p/344437#M5157</guid>
      <dc:creator>A_S</dc:creator>
      <dc:date>2017-03-26T18:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: plot graphical models from PROC HPBNET</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/plot-graphical-models-from-PROC-HPBNET/m-p/344602#M5158</link>
      <description>&lt;P&gt;If you use the HP BN Classifier node in Enterprise Miner, you will automatically get a graphical representation of the results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or in SAS code you can use the following code to use the SAS Graph Template Language for plotting the network &amp;nbsp;-- this code will be included in the online proceedings for SAS Global Forum 2017 for this presentation on the HPBNET procedure:&amp;nbsp;&lt;A href="https://event.crowdcompass.com/sgf2017-sessions/activity/kKxLYK6nMm" target="_self"&gt;https://event.crowdcompass.com/sgf2017-sessions/activity/kKxLYK6nMm&lt;/A&gt;&amp;nbsp;(&lt;SPAN&gt;Building Bayesian Network Classifiers Using the HPBNET Procedure). &amp;nbsp;Hope it helps!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
After running PROC HPBNET, to help visualize the final model, you can view the selected Bayesian &lt;BR /&gt;network structure by using the following macro createBNCdiagram, which takes the target variable &lt;BR /&gt;and the output network data as arguments.
*/
 
%macro createBNCdiagram(target=Class, outnetwork=net);
 
   data outstruct;
        set &amp;amp;outnetwork;
        if strip(upcase(_TYPE_)) eq 'STRUCTURE' then output;
        keep _nodeid_   _childnode_  _parentnode_;
   run;
 
   data networklink;
       set outstruct;
        linkid = _N_;
        label linkid ="Link ID";
   run;
 
   proc sql;
      create table work._node1 as
         select distinct  _CHILDNODE_ as  node
         from networklink;
      create table work._node2  as
         select distinct _PARENTNODE_  as node
         from networklink;
   quit;
 
   proc sql;
      create table work._node as
         select node
         from work._node1
         UNION
         select node
         from work._node2;
   quit;
 
   data bnc_networknode;
       length NodeType $32.;
       set work._node;
       if strip(upcase(node)) eq strip(upcase("&amp;amp;target")) then do;
         NodeType = "TARGET";
         NodeColor=2;
       end;
       else  do;
         NodeType = "INPUT";
         NodeColor = 1;
       end;
       label NodeType ="Node Type" ;
       label NodeColor ="Node Color" ;
 
   run;
 
   data parents(rename=(_parentnode_ = _node_)) children(rename=(_childnode_ = _node_)) links;
       length _parentnode_ _childnode_ $ 32;
       set networklink;
       keep _parentnode_ _childnode_ ;
   run;
 
   *get list of all unique nodes;
   data nodes;
       set parents children;
   run;
 
   proc sort data=nodes;
       by _node_;
   run;
 
   data nodes;
       set nodes;
       by _node_;
       if first._node_;
      _Parentnode_ = _node_;
      _childnode_ = "";
   run;
 
   /*merge node color and type */
   data nodes;
       merge nodes bnc_
 networknode (rename=(node=_node_ nodeColor=_nodeColor_ nodeType=_nodeType_));
       by _node_;
   run;
 
   /*sort color values to ensure a consistent color mapping across networks */
   /*note that the color mapping is HTML style dependent though */
   proc sort data=nodes;
       by  _nodeType_;
   run;
 
   *combine nodes and links;
   * need outsummaryall for model report;
   data bnc_networksummary(drop=_shape_ _nodecolor_ _nodepriority_ _shape_
_nodeID_ _nodetype_ _linkdirection_) bnc_networksummaryall;
       length _parentnode_ _childnode_ $ 32;
       set nodes links;
       drop _node_;
       if _childnode_ EQ "" thendo;
               _nodeID_ = _parentnode_;
               _nodepriority_ = 1;
               _shape_= "OVAL";
           end;
       else do;
         _linkdirection_ = "TO";
         output bnc_networksummary;
       end;
       output bnc_networksummaryall;
       label _linkdirection_="Link Direction";
   run;
 
    proc datasets lib=work nolist nowarn;
         delete _node _node1 _node2 nodes links parents children;
   run;
 
   quit;
 
   proc template;
      define statgraph bpath;
         begingraph / DesignHeight=720 DesignWidth=720;
            entrytitle "Bayesian Network Diagram";
            layout region;
              pathdiagram fromid=_parentnode_ toid=_childnode_ /
              arrangement=GRIP
              nodeid=_nodeid_
              nodetitle=_nodeID_
              nodeshape=_shape_
              nodepriority=_nodepriority_
              linkdirection=_linkdirection_
              nodeColorGroup=_NodeColor_
                        textSizeMin = 10
               ;
            endlayout;
         endgraph;
      end;
   run;
 
   ods graphics;
   proc sgrender data=bnc_networksummaryall template=bpath;
   run;
 
%mend;
 
%createBNCdiagram;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Mar 2017 20:20:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/plot-graphical-models-from-PROC-HPBNET/m-p/344602#M5158</guid>
      <dc:creator>WendyCzika</dc:creator>
      <dc:date>2017-03-31T20:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: plot graphical models from PROC HPBNET</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/plot-graphical-models-from-PROC-HPBNET/m-p/345092#M5167</link>
      <description>Thank you!&lt;BR /&gt;&lt;BR /&gt;Where can I find other options for the arrangement statement in the template proceedure?</description>
      <pubDate>Tue, 28 Mar 2017 17:34:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/plot-graphical-models-from-PROC-HPBNET/m-p/345092#M5167</guid>
      <dc:creator>A_S</dc:creator>
      <dc:date>2017-03-28T17:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: plot graphical models from PROC HPBNET</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/plot-graphical-models-from-PROC-HPBNET/m-p/364890#M5447</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/14512" target="_self"&gt;&lt;SPAN class="login-bold"&gt;WendyCzika,&lt;/SPAN&gt;&lt;/A&gt; could you favorably help me? I've tried to use the abovementioned SAS code for my bnet's visualization too - thank you very much! This is incredibly powerful instrument which I would like to upgrade and customize, but when I've started to learn "PATHDIAGRAM" block and it's options I've figured out that there is no information even on the official sites and blogs. All information I've found referred to the "PATHDIAGRAM" in PROC CALIS and PROC FACTOR, which has another structure. Could you share guides or topics you've read before for my more deep diving in programming and visualisation bnets?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jun 2017 10:23:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/plot-graphical-models-from-PROC-HPBNET/m-p/364890#M5447</guid>
      <dc:creator>Red_Fox</dc:creator>
      <dc:date>2017-06-07T10:23:35Z</dc:date>
    </item>
  </channel>
</rss>

