Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Knowledge Base

Definitive answers from Designer Desktop experts.

Predictive Tip: Can I Pull The Predictor Variables From An Object Model?

ChadM
Alteryx Alumni (Retired)
Created

We were recently approached by a concerned client with "Help! I have a model object in a .yxdb but my computer crashed and I need to document the predictor variables!" This naturally led to a discussion on how we can pull these variables back for the client, and what kind of scenarios would lead to this.

The first scenario is the most obvious (the case of the client). The model object was created using Alteryx and was stored in a .yxdb.  During another process, my computer crashed and I lost all of my data! Luckily, I still had the model object in a shared location, but I need to document the variables and the model object looks like this:


Unfortunately, this does not give us any information about the data or more importantly, the predictor variables. Luckily, a simple script can break down this model object and fill you in on all of the details.  

Within Alteryx, attach an R Tool to your data stream (I am using the Forest Model Object that is created from an Alteryx Sample):
 

R.PNG


Next, copy and paste the following script into your R Tool code builder:

model.data <- read.Alteryx("#1")
the.obj <- unserializeObject(as.character(model.data$Object[1]))
print(the.obj$call) 

This script states to take the data coming in from Input #1 and label it "model.data".  Next, unserialize (break down) the data in the field Object (specified by "model.data%Object[1]").  Finally, print the results in the Alteryx Output window.  The final results for this particular object are then printed out, as shown.


As you can see, the output clearly states that my predictor variables are Chk_Bal, Duration, Credit_Hist, Purpose, etc.  The end result is quick, clean, and can really help get you out of a jam if you lose your data.