We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

How to Score when you have a Lagged Dependent Variable?

AmyL1
7 - Meteor

I am trying to use the scoring tool to generate predictions using the model I built with the Linear Regression tool. The problem is, one of my explanatory variables is a lagged dependent variable so I need each new prediction to automatically feed into the lagged dependent variable field for the scoring tool to work

 

With my input data, I defined by lag field using the Multi-Row Formula tool:

 

if [RecordID] = 1 then 0.0013 else [Row-1:NLdiff] endif

 

However, this formula isn't translating forward when new NLdiff values are scored. I'm thinking I have to create a batch macro of some sort but I don't know where to start. Any help is appreciated here!

13 REPLIES 13
rkapoor
Alteryx
Alteryx

Brilliant effort - I think we are nearly there.

 

I have modified the macro slightly to replace 'Predicted' with 'Predicted_X'.

 

Can you try this and let me know?

AmyL1
7 - Meteor

What was your reasoning behind that? It looks like that just changed the name of the "Predicted" field to "Predicted_X", so I ran into the same issue. It's only iterating once and I can't seem to figure out why

 

I tried to modify it even further to union everything so the output is exactly the same as the initial input except now Lag_Y has the extra value (so the scoring tool should be able to calculate a Predicted_X for that row as well). However, I feel like my input tool is not actually picking up my output for whatever reason. I have a file input within my macro input tool (with my original data) with the idea that this is only going to be used for the first iteration, and the remaining iterations will use the I Output data. But is this not correct? I'm afraid I'm resetting everything by having a file input

 

Thanks again for all the help here, I really appreciate it!

AmyL1
7 - Meteor

I figured it out! My macro was fine I was just not executing it correctly (I didn't realize you needed a separate workflow to run it...oops)

 

Thanks again for all the help!!! It helped so much

rkapoor
Alteryx
Alteryx

🙂Yeh you need to run the macro from another workflow but glad you figured that out and it worked in the end. Let me know how your other workflows come along.

Labels
Top Solution Authors