Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Output model objects with python tool

mauricio
8 - Asteroid

Hi,

 

It is possible to export a sklearn model object (trained decision tree model) to a python tool output anchor?

I wanto to work with my python models just like i work with the out-of-the-box alteryx modeling tool.

In the out-of-the-box tools, the model is outputed as an object in the decision tree "O" anchor.

 

I read about using piclke to serialize ande deserialize objects, however, I could not find a way to output the serialized object as a dataframe.

Regards.

3 REPLIES 3
apathetichell
19 - Altair

Out of the box Alteryx models are in R.  You'd need to convert your object model from python to R. There are some discussions of it on stackoverflow and say here for example: https://medium.datadriveninvestor.com/switching-objects-from-python-to-r-d8b2207ff7fb

 

But your underlying issue is making Python and R play nice - Alteryx is just the conduit here.

mauricio
8 - Asteroid

@apathetichell 

Thanks for the quick reply.

 

My Main goal is to export the python object to use it later with a python tool.

It will be much more convenient to work it as an output anchor.

I have no intention to mix the python and the R tools.

 

Te issue is that the python tool only allow to export dataframes with the "Alteryx.write" method

I'm sarching for a workaround, to convert the model object to a data frame for example.

apathetichell
19 - Altair

I'm more of an R person than a Python person but can't you add the model as an object into the data frame???? Alteryx let's you take out Histograms and charts from Python so I'd be surprised if you couldn't send out other objects. For R, I usually use a name/object two column DF. I have to say I'm a bit confused. I'd also think you could save your code or snippets of it and then load/reload it in a different python tool.

 

Also - I think you asked about using Alteryx's out of the box tools with your model - and that you won't be able to do because those require R. So you can't hook up a Python random forest model into a Score tool with some new data and get it to run unlike an R model.

Labels