<?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 Open SOurce Code (Python) in Model Studio not working in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/Open-SOurce-Code-Python-in-Model-Studio-not-working/m-p/746001#M8693</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have added an open source node in model studio and i have written the following pyhton script. It seem that the system does not recognize the dm_model.fit part of the script and returns an error. Any suggestions?&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Andreas&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;from sklearn import decisiontreeclassifier
import sklearn as sk
from sklearn.metrics import accuracy_score
from pandas.api.types import is_object_dtype
import pandas as pd
import numpy as np
import pickle

# because of transformation/imputation process, some columns are converted into objects
# the lines below will convert all the objects into a string type

Y_full = dm_inputdf[dm_dec_target]
X_full = dm_inputdf[dm_interval_input]

Y_train = dm_traindf[dm_dec_target]
X_train = dm_traindf[dm_interval_input]


dm_model=DecisionTreeClassifier()
dm_model=dm_model.fit(X_train, Y_train)&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andreas_zaras_0-1623138043028.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/60113i12A9A80D8863A0CA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andreas_zaras_0-1623138043028.png" alt="andreas_zaras_0-1623138043028.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Jun 2021 07:41:48 GMT</pubDate>
    <dc:creator>andreas_zaras</dc:creator>
    <dc:date>2021-06-08T07:41:48Z</dc:date>
    <item>
      <title>Open SOurce Code (Python) in Model Studio not working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Open-SOurce-Code-Python-in-Model-Studio-not-working/m-p/746001#M8693</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have added an open source node in model studio and i have written the following pyhton script. It seem that the system does not recognize the dm_model.fit part of the script and returns an error. Any suggestions?&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Andreas&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;from sklearn import decisiontreeclassifier
import sklearn as sk
from sklearn.metrics import accuracy_score
from pandas.api.types import is_object_dtype
import pandas as pd
import numpy as np
import pickle

# because of transformation/imputation process, some columns are converted into objects
# the lines below will convert all the objects into a string type

Y_full = dm_inputdf[dm_dec_target]
X_full = dm_inputdf[dm_interval_input]

Y_train = dm_traindf[dm_dec_target]
X_train = dm_traindf[dm_interval_input]


dm_model=DecisionTreeClassifier()
dm_model=dm_model.fit(X_train, Y_train)&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="andreas_zaras_0-1623138043028.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/60113i12A9A80D8863A0CA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="andreas_zaras_0-1623138043028.png" alt="andreas_zaras_0-1623138043028.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Jun 2021 07:41:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Open-SOurce-Code-Python-in-Model-Studio-not-working/m-p/746001#M8693</guid>
      <dc:creator>andreas_zaras</dc:creator>
      <dc:date>2021-06-08T07:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Open SOurce Code (Python) in Model Studio not working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Open-SOurce-Code-Python-in-Model-Studio-not-working/m-p/746309#M8711</link>
      <description>&lt;P&gt;Please,&lt;/P&gt;
&lt;P&gt;ANY time you ask about an error, show the log with the entire procedure code and all the messages, errors, warnings and notes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Copy from the log and paste into a text box opened on the forum with the &amp;lt;/&amp;gt; icon to preserve formatting of text as SAS often supplies diagnostic information that is column specific and the message windows will reformat the text making the messages less useful or readable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With "returns an error" we don't have any clue what the error is. You might just have misspelled a variable, data set name or option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jun 2021 16:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Open-SOurce-Code-Python-in-Model-Studio-not-working/m-p/746309#M8711</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-07T16:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Open SOurce Code (Python) in Model Studio not working</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Open-SOurce-Code-Python-in-Model-Studio-not-working/m-p/747463#M8722</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I found the error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had to import the python tree library at the beggining of the script i.e.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;from sklearn import tree&lt;/PRE&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Andreas&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 18:33:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Open-SOurce-Code-Python-in-Model-Studio-not-working/m-p/747463#M8722</guid>
      <dc:creator>andreas_zaras</dc:creator>
      <dc:date>2021-06-11T18:33:15Z</dc:date>
    </item>
  </channel>
</rss>

