<?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 Encode Y in Open Source Code Node in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/Encode-Y-in-Open-Source-Code-Node/m-p/699194#M8490</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I follow this &lt;A href="https://github.com/sassoftware/sas-viya-dmml-pipelines/blob/master/open_source_code_node/simple_forest/sf_onehotvars_sklearn_randomforest.py" target="_self"&gt;repo&lt;/A&gt;&amp;nbsp;to create my open source code node. My target is character, so I need to add label encoder (from sklearn) to transform it to numeric. Here is my code:&lt;/P&gt;&lt;PRE&gt;le = LabelEncoder()
y = le.fit_transform(dm_traindf[dm_dec_target])

X = dm_traindf.loc[:, dm_input]

params = {'n_estimators': 100}
dm_model = RandomForestClassifier(**params)
dm_model.fit(X, y)

fullX = dm_inputdf.loc[:, dm_input]
dm_inputdf.predict(fullX)&lt;/PRE&gt;&lt;P&gt;I was able to run the fit, but when I tried to get the predict value the program failed. I guess the label or the level is not lined up with input, but I don't know how to fix.&amp;nbsp;&lt;/P&gt;&lt;P&gt;TIA for all the help or comments, thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 16 Nov 2020 15:52:32 GMT</pubDate>
    <dc:creator>DaisyQL</dc:creator>
    <dc:date>2020-11-16T15:52:32Z</dc:date>
    <item>
      <title>Encode Y in Open Source Code Node</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Encode-Y-in-Open-Source-Code-Node/m-p/699194#M8490</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I follow this &lt;A href="https://github.com/sassoftware/sas-viya-dmml-pipelines/blob/master/open_source_code_node/simple_forest/sf_onehotvars_sklearn_randomforest.py" target="_self"&gt;repo&lt;/A&gt;&amp;nbsp;to create my open source code node. My target is character, so I need to add label encoder (from sklearn) to transform it to numeric. Here is my code:&lt;/P&gt;&lt;PRE&gt;le = LabelEncoder()
y = le.fit_transform(dm_traindf[dm_dec_target])

X = dm_traindf.loc[:, dm_input]

params = {'n_estimators': 100}
dm_model = RandomForestClassifier(**params)
dm_model.fit(X, y)

fullX = dm_inputdf.loc[:, dm_input]
dm_inputdf.predict(fullX)&lt;/PRE&gt;&lt;P&gt;I was able to run the fit, but when I tried to get the predict value the program failed. I guess the label or the level is not lined up with input, but I don't know how to fix.&amp;nbsp;&lt;/P&gt;&lt;P&gt;TIA for all the help or comments, thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 16 Nov 2020 15:52:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Encode-Y-in-Open-Source-Code-Node/m-p/699194#M8490</guid>
      <dc:creator>DaisyQL</dc:creator>
      <dc:date>2020-11-16T15:52:32Z</dc:date>
    </item>
    <item>
      <title>Re: Encode Y in Open Source Code Node</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Encode-Y-in-Open-Source-Code-Node/m-p/699489#M8491</link>
      <description>Hi,&lt;BR /&gt;When you say it failed, can you tell if the failure was in Python or afterwards in the Open Source Code node?. Did you place the node in the Supervised Lane?&lt;BR /&gt;&lt;BR /&gt;Also, can you post back the failure messages from the log - When an error occurs in the Open Source Code node, the generic message Encountered error code 1 when executing Python program is highlighted in the log. The detailed error messages that help pinpoint the problem are displayed above this generic message and you can scroll up to view them. You can also search for the first occurrence of executeProcess string in the log to see the start of these detailed error messages.&lt;BR /&gt;&lt;BR /&gt;I would think your use case should work as the only two columns needed in dm_scoreddf  dataframe that the node expects you to create (if it is in Supervised Lane) are posterior probabilities. I am assuming here that you have a binary or nominal target. It should not matter that you label encoded the target and used it in the Python code.&lt;BR /&gt;&lt;BR /&gt;Radhikha</description>
      <pubDate>Tue, 17 Nov 2020 13:46:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Encode-Y-in-Open-Source-Code-Node/m-p/699489#M8491</guid>
      <dc:creator>RadhikhaMyneni</dc:creator>
      <dc:date>2020-11-17T13:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: Encode Y in Open Source Code Node</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Encode-Y-in-Open-Source-Code-Node/m-p/699570#M8492</link>
      <description>&lt;P&gt;Thank you so much! It is so helpful and you save my life!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I checked my log and found the issue, because I had missing data in fullX, once I remove the missing data, the node can produce the result.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for helping me locate the error message. I was very struggling with finding out the error in the log, maybe the team could consider highlight the python error message in the future that would be easier for users like me know very little about SAS code.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 17:29:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Encode-Y-in-Open-Source-Code-Node/m-p/699570#M8492</guid>
      <dc:creator>DaisyQL</dc:creator>
      <dc:date>2020-11-17T17:29:35Z</dc:date>
    </item>
  </channel>
</rss>

