<?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: SAS Deep Learning FCMP: Subroutines and Functions in SAS Academy for Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Academy-for-Data-Science/SAS-Deep-Learning-FCMP-Subroutines-and-Functions/m-p/701279#M995</link>
    <description>&lt;P&gt;In this example we are using the FCMPACT CAS Action to create an FCMP routine which can be stored in a table. We are doing this because we will need to use the FCMP routine later in the example as part of the Deep Learning Action set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC CAS has the ability to directly create user defined functions without using FCMP and thus without a subroutine wrapper (as described in this documentation page:&amp;nbsp;&lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=caslpg&amp;amp;docsetTarget=n10r5mjey8zj55n118yucvyd0d17.htm&amp;amp;locale=en"&gt;https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=caslpg&amp;amp;docsetTarget=n10r5mjey8zj55n118yucvyd0d17.htm&amp;amp;locale=en)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Although these functions defined directly in PROC CAS can be used for some tasks in PROC CAS, they cannot be used in all CAS Actions.&lt;/P&gt;
&lt;P&gt;In particular we are trying to create a custom learning rate function which will be used in the&amp;nbsp;&lt;STRONG&gt;algorithm&lt;/STRONG&gt; statement in the&amp;nbsp;&lt;STRONG&gt;dlTrain&lt;/STRONG&gt; CAS Action. The&amp;nbsp;&lt;STRONG&gt;algorithm&lt;/STRONG&gt; statement has an option&amp;nbsp;&lt;STRONG&gt;fcmplearningrate&lt;/STRONG&gt;, which allows us to specify a FCMP function to use to adjust the learning rate. The syntax here in&amp;nbsp;&lt;STRONG&gt;dlTrain&lt;/STRONG&gt; does not support functions defined in CAS without the use of FCMP, so we are forced to define our function using the FCMP subroutine as a wrapper. This is due to the syntax expectations of the&amp;nbsp;&lt;STRONG&gt;dlTrain&amp;nbsp;&lt;/STRONG&gt;CAS Action.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the snippet of code I was pointing out from the course notes in section 5.5:&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;proc cas; 
    dlTrain / table={name='Encoders', where='_PartInd_=1'} model='ConVNN3' 
        modelWeights={name='ConVTrainedWeights_d', replace=1} 
        bestweights={name='ConVbestweights', replace=1} 
        dataSpecs={ {data={'_LayerAct_0_IMG_0_'}, layer='data1', type='Image'} {data={'_LayerAct_11_IMG_0_'}, layer='data2', type='Image'} {data='_label_', layer='outlayer', type='numericNominal'} }
        GPU=True ValidTable={name='Encoders', where='_PartInd_=2'} 
        optimizer={minibatchsize=80, 
        algorithm={method='Momentum', gamma=1.006, fcmplearningrate='CusLR' , learningrate=.01} loglevel=2 maxepochs=160} 
        seed=12345; 
Quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since the&amp;nbsp;&lt;STRONG&gt;dlTrain&lt;/STRONG&gt; action explicitly expects a custom learning rate function in the form of an FCMP routine (the&amp;nbsp;&lt;STRONG&gt;fcmplearningrate&lt;/STRONG&gt; parameter above) we must define our function using the FCMP subroutine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Great question!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Ari Zitin&lt;/P&gt;</description>
    <pubDate>Tue, 24 Nov 2020 16:48:45 GMT</pubDate>
    <dc:creator>AriZitin</dc:creator>
    <dc:date>2020-11-24T16:48:45Z</dc:date>
    <item>
      <title>SAS Deep Learning FCMP: Subroutines and Functions</title>
      <link>https://communities.sas.com/t5/SAS-Academy-for-Data-Science/SAS-Deep-Learning-FCMP-Subroutines-and-Functions/m-p/701110#M994</link>
      <description>&lt;P&gt;I am going through the "Deep Learning using SAS Software" and I am on Lesson 5: Transfer Learning and Customization .&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is a demo on "Creating a customized Learning Rate Policy using FCMP. "I am referring to the 4th and 5th lines ( please see below) of the proc cas. It says:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;fcmpact.addRoutines&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;routineCode = {"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt; Function Definition&amp;nbsp; &amp;gt;&lt;/P&gt;&lt;P&gt;endsub&lt;/P&gt;&lt;P&gt;"&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This seems as if we are defining a function within&amp;nbsp; a subroutine. ( addRoutines&amp;nbsp; ..endsub).&amp;nbsp; Can we not define a function directly without a subroutine "wrapper" type&amp;nbsp; of construct ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Odesh.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Odesh2_0-1606172968663.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/51945i1E527A554C35358A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Odesh2_0-1606172968663.png" alt="Odesh2_0-1606172968663.png" /&gt;&lt;/span&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 23:28:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Academy-for-Data-Science/SAS-Deep-Learning-FCMP-Subroutines-and-Functions/m-p/701110#M994</guid>
      <dc:creator>Odesh2</dc:creator>
      <dc:date>2020-11-23T23:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Deep Learning FCMP: Subroutines and Functions</title>
      <link>https://communities.sas.com/t5/SAS-Academy-for-Data-Science/SAS-Deep-Learning-FCMP-Subroutines-and-Functions/m-p/701279#M995</link>
      <description>&lt;P&gt;In this example we are using the FCMPACT CAS Action to create an FCMP routine which can be stored in a table. We are doing this because we will need to use the FCMP routine later in the example as part of the Deep Learning Action set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC CAS has the ability to directly create user defined functions without using FCMP and thus without a subroutine wrapper (as described in this documentation page:&amp;nbsp;&lt;A href="https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=caslpg&amp;amp;docsetTarget=n10r5mjey8zj55n118yucvyd0d17.htm&amp;amp;locale=en"&gt;https://go.documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=caslpg&amp;amp;docsetTarget=n10r5mjey8zj55n118yucvyd0d17.htm&amp;amp;locale=en)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Although these functions defined directly in PROC CAS can be used for some tasks in PROC CAS, they cannot be used in all CAS Actions.&lt;/P&gt;
&lt;P&gt;In particular we are trying to create a custom learning rate function which will be used in the&amp;nbsp;&lt;STRONG&gt;algorithm&lt;/STRONG&gt; statement in the&amp;nbsp;&lt;STRONG&gt;dlTrain&lt;/STRONG&gt; CAS Action. The&amp;nbsp;&lt;STRONG&gt;algorithm&lt;/STRONG&gt; statement has an option&amp;nbsp;&lt;STRONG&gt;fcmplearningrate&lt;/STRONG&gt;, which allows us to specify a FCMP function to use to adjust the learning rate. The syntax here in&amp;nbsp;&lt;STRONG&gt;dlTrain&lt;/STRONG&gt; does not support functions defined in CAS without the use of FCMP, so we are forced to define our function using the FCMP subroutine as a wrapper. This is due to the syntax expectations of the&amp;nbsp;&lt;STRONG&gt;dlTrain&amp;nbsp;&lt;/STRONG&gt;CAS Action.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the snippet of code I was pointing out from the course notes in section 5.5:&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;proc cas; 
    dlTrain / table={name='Encoders', where='_PartInd_=1'} model='ConVNN3' 
        modelWeights={name='ConVTrainedWeights_d', replace=1} 
        bestweights={name='ConVbestweights', replace=1} 
        dataSpecs={ {data={'_LayerAct_0_IMG_0_'}, layer='data1', type='Image'} {data={'_LayerAct_11_IMG_0_'}, layer='data2', type='Image'} {data='_label_', layer='outlayer', type='numericNominal'} }
        GPU=True ValidTable={name='Encoders', where='_PartInd_=2'} 
        optimizer={minibatchsize=80, 
        algorithm={method='Momentum', gamma=1.006, fcmplearningrate='CusLR' , learningrate=.01} loglevel=2 maxepochs=160} 
        seed=12345; 
Quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since the&amp;nbsp;&lt;STRONG&gt;dlTrain&lt;/STRONG&gt; action explicitly expects a custom learning rate function in the form of an FCMP routine (the&amp;nbsp;&lt;STRONG&gt;fcmplearningrate&lt;/STRONG&gt; parameter above) we must define our function using the FCMP subroutine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Great question!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-Ari Zitin&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 16:48:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Academy-for-Data-Science/SAS-Deep-Learning-FCMP-Subroutines-and-Functions/m-p/701279#M995</guid>
      <dc:creator>AriZitin</dc:creator>
      <dc:date>2020-11-24T16:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Deep Learning FCMP: Subroutines and Functions</title>
      <link>https://communities.sas.com/t5/SAS-Academy-for-Data-Science/SAS-Deep-Learning-FCMP-Subroutines-and-Functions/m-p/701837#M996</link>
      <description>&lt;P&gt;Thanks Ari.&lt;/P&gt;&lt;P&gt;Nice clear explanation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Odesh.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 14:39:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Academy-for-Data-Science/SAS-Deep-Learning-FCMP-Subroutines-and-Functions/m-p/701837#M996</guid>
      <dc:creator>Odesh2</dc:creator>
      <dc:date>2020-11-26T14:39:25Z</dc:date>
    </item>
  </channel>
</rss>

