Splunk Search

How to calculate a linear regression for each field and predict the next possible number in my search query?

New Member

Suppose I have this data (but in thousands, is just an example):

ID class qty
1 cup 5
2 cup 6
3 cup 2
4 cup 7
5 mug 1
6 mug 3
7 mug 4

I want to calculate a linear regression for "qty" (or just to use the predict command) for each "class", so I want one predict (or linear regression can work too) next possible number for "cup" and for "mug".

Considering that there are not only 2 different classes but thousands of it, how can I do this?

ps: I have tried with "map" command but it limits my results to only 10 iterations even after I have modified the "maxsearches" parameter but didn't work.

0 Karma

SplunkTrust
SplunkTrust

I agree with @martin_muller .. This is a BIG job for the predict command and will kill your hardware and will most likely not give you the desired results. Download the MLTK and fit a model with linear regression and it will give you feedback as to how accurate it is

0 Karma

New Member

Thanks, i'm trying with MLTK, altough i can not see how to make one "prediction" for each type

i can only get the models to show data for "total" numbers

0 Karma

SplunkTrust
SplunkTrust

I'm not quite sure I understand what you want, but it sounds like a job for the Machine Learning Toolkit, not for the predict or even map commands: https://splunkbase.splunk.com/app/2890/

New Member

yes, the problem i keep finding in splunk is that regardless i use Machine Learning Toolkit it only works for a single series, and i want to do the calculation for each class, thats why i have tried using map to "iterate" trough ecach "class" or series and the making the predict command

and i see is the same with machine learning toolkit, it only works for only one thing, for example: how many sales im expecting for next time slot, but not how many sales im expecting for each item

thanks anyway

0 Karma

SplunkTrust
SplunkTrust

@saenito, in that case, instead of Forecast Time Series you should check out Predict Categorical Fields

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

SplunkTrust
SplunkTrust

@saenito, you should definitely explore the Machine Learning Toolkit App which comes with several Machine Learning Algorithms not just Linear Regression.

If you just want to implement Linear Regression, try to check out the following Splunk Wiki: https://wiki.splunk.com/Community:Plotting_a_linear_trendline

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"