Happy 8th birthday to the Maveryx Community! Take a walk down memory lane in our birthday blog, and don't miss out on the awesome birthday present that all Maveryx Community members get to take advantage of!
alteryx Community

# Alteryx Designer Desktop Discussions

## Is it possible to create a recursive predictive alteryx model using multiple factors in?

7 - Meteor

Hi all,

I want to create a warranty alteryx predictive model wherein I have historical warranty data. I have data from the year 2015 to 2019. Based on 2015 repair costs which is changing monthly, I want to predict the repair costs for 2016 based on the warranty type (Basic/Extended) and product type. Also, the 2017 repair costs should be dependent on 2016 repair costs calculated using the model. This activity needs to be recursive. Is there a way to achieve this?

11 REPLIES 11
8 - Asteroid

If you predicted 2016 repairs based on 2015, what stops you from predicting 2017 with 2016 repair cost?

8 - Asteroid

If I may understand @diyer  do you want to predict 2016,2017, 2018, and 2019 repair cost separately?

If yes, you have the predictor variables for each year and the target variable which is the repair cost for each year's data right?

7 - Meteor

So the scenario goes like this:

I have sales id, date of sales, type of repair (screen/battery), year of sale, cost of repair, warranty type (basic/extended). The data is from 2015 to 2019. For 2015, if I consider an average cost of repair; I need to calculate the cost of repair from 2016 to 2019 monthly based on cost of repair of 2015, the warranty type (basic/Extended), and type of repair. In general if you see, the screen repair cost is more than battery cost. So how do I go ahead creating a model using these factors and calculate the cost of repair for future years?

8 - Asteroid

Check out this excel file, I mocked something up, is this how your data looks like?

If not what are the modifications? you can modify and resend so I understand you clearly.

7 - Meteor

@Cndro_Consulting  thank you for spending time to go through this. I really appreciate it. I have attached the sample data which I have made. Lets say for 2015, I calculated the average of Cost of Repair for Screen & Battery for both extended and basic warranty types. Now, I want to train my model in such a way that January 2016 gets predicted with the cost of repair based on the factors type of repair and  warranty type. The cost of repair coming from Jan 2016 should also be considered as a parameter for Feb 2016s calculation of cost of repair. That means for Feb 2016 the factors would be type of repair, cost of repair of Jan 2016 and warranty type. I want my model to be recursive in such a way that the cost of repair of next month also takes into account the previous month's cost of repair.

8 - Asteroid

Currently building a workflow, you will tell me what needs to be modified when I am done @diyer

8 - Asteroid

I attached a zip file, Let me know what you think and what modifications should be added. Thinking about it, if average cost is used all through as a field that is a constant and that would not affect the linear regression model in any way, constants have no effect in models.

Let me know what you think @diyer

7 - Meteor

Till calculating the average cost of repair for Year 2015 looks fine. However, based on this calculation for 2015, I want to predict the monthly cost of repair for 2016. This could change since there can be factors of inflation, component cost might have increased or decreased etc. For once we predict the cost of repair for 2016 January for instance, that cost of repair for January 2016 should also be the driving factor for the calculation of February 2016 cost of repair and so on. That is the reason I said it should be recursive in nature. And moreover I feel the average of cost of repair for 2015 should be calculated separately for screen & battery since the cost of repair for both might vary. is it possible to achieve this? If yes, which model should be used?

Alteryx

Hi @diyer ,

I have a similar business case whereby the Demand prediction of Day T is dependent on the Mean & Median Demand prediction of previous time periods, e.g.:

Day T-1

Day T-2

Day T-3 and so on...

So I'm unable to predict Day T+1 until I have predicted the outcome of Day T - and hence the solution similarly needs to be recursive. Is the challenge similar?

If so, one way to accommodate this recursiveness is to implement an iterative macro when performing the prediction, so that the macro:

1. Predicts Day T

2. Calculates the Mean/Median of Day T and Day T-1

3. Then, inserts this new calculation as a factor to predict Day T+1

4. And process repeats for Day T+2Day T+3 and so on...

For more info on how to build an iterative macro, you may take a look at this tutorial video here in our Alteryx Academy: https://community.alteryx.com/t5/Videos/Build-Your-First-Iterative-Macro/td-p/55565

Do note that the predictive model itself should ideally be embedded inside the iterative macro in order to score the new data & sequential time period on a recursive basis.

Best,

Michael

Labels