Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

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

Implementing trained Python model on Server workflow

chrisha
11 - Bolide

Hello everyone,

 

I am wondering how to implement and deploy a trained model for use within an Alteryx workflow, that runs on an Alteryx server.

 

The model (using `scikit-learn` and `xgboost`) is trained and validated in Python outside of Alteryx. I'd simply pickle the trained model to be used later.

In Alteryx, I'd like to load the model within the Python tool to make predictions for data coming through Alteryx. There I wonder about two things:

 

  1. How do I install `xgboost` for use in the Python tool on the server? For my local Designer installation, I know about installing it through the tool after starting it as an administrator. I have access to the Alteryx server machine - can I simply start designer on this machine as an administrator, and install it through the Python tool as I would locally? Will the package then be available for any workflow on any worker instance?
  2. How do I reference the model in the Python tool? Sure, I could put the model somewhere on a file server on the network and reference it using a UNC path. Is there a better way? E.g. somehow include it as a workflow asset and load it in the Python tool? My main concern here is the persistence of the model: even if something changes on the file server the workflow should always use the same version of the model.

I guess others have already faced similar problems? What's the best practice -- i.e. when not using Promote?

 

Looking forward to your suggestions!

Best

Christopher

2 REPLIES 2
DiganP
Alteryx Alumni (Retired)

@chrisha You would follow the same steps on the Server's Designer as you would on your desktop. On the server, you would run Designer as admin and use the python tool to install the packages you are looking for. The pickle file would be on the server and you would reference it in the Python tool. Since its a file made out of bits/bytes, you cannot bring in as a model object using the regular tools. Thus, you have to use the Python tool (UNC path) to reference it. 

 

Hope that helps. 

Digan
Alteryx
chrisha
11 - Bolide

Thanks, @DiganP !

 

While including the model as asset would have been nice, we now use the UNC path and it works fine.

 

Just a heads up for anyone finding this thread later: Pickled objects only work well across the same version of Python. My Alteryx uses Python 3.6.0, so your training environment needs the same version. And you might want to use the command line to upgrade packages such as numpy or scipy in the Python tool environment.

Labels