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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.