Hi,
I follow this repo 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:
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)
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.
TIA for all the help or comments, thanks!
Thank you so much! It is so helpful and you save my life!
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.
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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.