Hello,
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?
Thanks,
Andreas
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)
Hello!
I found the error.
I had to import the python tree library at the beggining of the script i.e.
from sklearn import tree
Thanks,
Andreas
Please,
ANY time you ask about an error, show the log with the entire procedure code and all the messages, errors, warnings and notes.
Copy from the log and paste into a text box opened on the forum with the </> 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.
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.
Hello!
I found the error.
I had to import the python tree library at the beggining of the script i.e.
from sklearn import tree
Thanks,
Andreas
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.
Find more tutorials on the SAS Users YouTube channel.