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 Promote Knowledge Base

Definitive answers from Promote experts.

Your First Promote Model

PatrickN
Alteryx Alumni (Retired)
Created
PRODUCT: Alteryx Promote
VERSION: 2018.1
LAST UPDATE: 05/23/2018
ATTACHMENT: 2018.1

Want to get started with Promote, but don't know Python?

This article describes:

  • What to install for Python (at least one way) and how to install the Promote library (there are many different ways to do this – this is only one)
  • Where to find some useful documentation (GitHub, Community)
  • How to test and deploy a Python model into Promote and test it on the web console
  • How to deploy a model from Alteryx and score it from Alteryx as well as in the web console

  1. Download Anaconda 3.6 (https://www.anaconda.com/download/ ) – this includes Python and other programs you’ll need to get started. I found this the easiest way to proceed.
  2. Once installed, run the Anaconda Prompt (I use this instead of command line).
  3. Update PIP: python -m pip install -U pip update_pip.png
  4. Install Promote package: python -m pip install promote install_promote.png
  5. Obtain the sample models from Github.
    1. Code-Friendly models - R and Python examples
    2. For this document, we will use the Python modelspython_models.png
    3. The link will take you to the examples page of the promote-python library. Click on the parent to go up a level.github.png
    4. This page has a ton of useful information that I recommend you read. For getting started, download the library to your computer.download.png
    5. I recommend creating a repository folder on your computer and storing the files there.
  6. Log into the Promote web app
  7. Go to your Account page and obtain your user name and API Key – store these in a file or somewhere easy to access as you’ll need the information.account.png
  8. Now – let’s publish an example from Python into Promote.
  9. Open main.py from the \repositories\promote-python-master\examples\hello-world folder using your favorite text editor. I like Sublime Text ( https://www.sublimetext.com/ ) but you can use whatever you’d like. Windows 10 has a built-in editor or some people prefer Notepad++.
  10. Edit the USERNAME, API_KEY, and PROMOTE_URL information with your information. I would recommend copying this section of the code so it’s easy to re-use.credentials.png
  11. Before deploying, test the model. EXTREMELY IMPORTANT! I’ll show two ways to test the model: Command Prompt and Jupyter
    1. Command Prompt
        1. First, comment out the line with the deploy method.comment.png
        2. Navigate to the folder that contains the hello-world main.py file you just edited from the Anaconda Command Prompt.command_prompt1.png
        3. Type python main.py to test the code.command_prompt2.png
    2. Jupyter – this is great for testing and learning Python in my opinion. NOTE: you can’t deploy Jupyter notebooks to Promote. https://github.com/alteryx/promote-python/tree/master/examples/svc-classifier
        1. Launch the Jupyter Notebook
        2. Navigate to the hello-world folderjupyter.png
        3. Click on main.pymain.png
        4. Copy the code
        5. Go back to the directory page and create a new Jupyter notebooknew_notebook.png
        6. Paste the code into the notebook
        7. Comment out the deploy method and run the module.run_module.png
  1. To deploy the model:
    1. Now, edit the main.py file and uncomment the deploy method.deploy.png
    2. Looking at the instructions from Github (https://github.com/alteryx/promote-python/tree/master/examples/hello-world ), we need to install the requirements.txt file for this model. Type: pip install -r requirements.txtinstall_requirements.png
    3. Now deploy the model by typing python main.pypython_main.png
    4. You should now see your model in Promotepromote.png
    5. Click on the model and test it from the web console. Model tests require a line-delimited JSON file (.ldjsonfor short) – see https://github.com/json-ld/json-ld.orgtest_model.png

  1. Now, try publishing the IrisClassifier model yourself. To test it, use the following code:test_iris.png
  2. In Alteryx, you can easily deploy a model to Promotedesigner_deploy.png
  3. When the workflow is run, the model will be promoted.logistic.png
  4. You can test the model using the Promote web console.test_logistic.png
  5. You can now score sample data using either the Alteryx model, or the model running on Promote.score_logistic.png
Attachments
Comments
JohnJPS
15 - Aurora

Quick question, and I'm not sure where to put it.  For operationalizing a model, one thing we're seeing is that the business area just has their business data.  A modeling team will mix in various additional data (e.g. say, demographics), in order to build a better model... they may also do PCA and various other feature engineering and reduction). So, when it comes time to score, the business system does not possess all the engineered columns required by the model.  We need to do, what we're referring to as "external data joins" at scoring time.

 

The easy solution for this is to tell the business system too bad, so sad: you need to jump through hoops to build the correct columns.

 

Long story short. We don't have Alteryx Server, but my understanding is that if we did, we could deploy a full-on workflow that takes in the business area data, does the "external data joins" and column development... and then, heck since we're already in a full-on workflow, why not just include the scoring process there and return the score, perhaps with additional useful info (error handling, score interpretation, etc)?  [And this is all available via REST API on Alteryx Server.]

 

Is that a reasonable thought process?  Thanks!

 

PatrickN
Alteryx Alumni (Retired)

Yes, you are on the right path.

 

There are a few options:

1. You could build a full workflow that does all the prep work and joins.

2. You could score the model with the Python SDK tool, or if the model is deployed to Promote, the prepared data could be sent to Promote for scoring.  You could also build all the external joins using the Python SDK tool.

 

With Alteryx Server, the entire workflow could be called using the API.  Alternatively, you could build an analytic app where a user could add their data and run the workflow on the Server (without using the API).

alekgio
7 - Meteor

Hello,

 

How install alteryx promote, i have alteryx promote license but the problem is i can't install promote. i need tutorial promote installation.

 

Thank you