Archive

How to calculate the linear regression coefficients in SPlunk?

dragut
New Member

I have calculated the ten different percentiles of a response time field and want to make a linear regression of the the 10 data values with the 0.1 to 1 interval points. Is there a way to get the intercept and slope values and R2 stats in Splunk? Thanks.

Tags (1)
0 Karma

niketnilay
Legend

@dragut, get Machine Learning Toolkit App from Splunkbase. It has the macro/SPL required to calculate R2 statistics for Forcasting time series.

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

dragut
New Member

What about slope and intercept?

0 Karma

niketnilay
Legend

Please check out Splunk Machine Learning Toolkit App (MLTK). With current release 3.2 it has 30 algorithms implemented for 8 different categories: http://docs.splunk.com/Documentation/MLApp/latest/User/Algorithms
https://www.splunk.com/pdfs/solution-guides/machine-learning-quick-ref-guide.pdf

MLTK also allows you to import the algorithm of your choice to Splunk using Machine Learning API.

Once the app is installed, it also has links to several video tutorials related to Machine Learning Toolkit.

While you should be using MLTK App for implementing Machine Learning in your Splunk App, you can also refer to following Wiki for Linear Regression implementation using SPL.

https://wiki.splunk.com/Community:Plotting_a_linear_trendline

Please try out MLTK, read documentation and go through tutorial videos and confirm!

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

Sukisen1981
Champion

As @niketnilay mentioned, the best way is to actually install the Splunk MLTK app (remember to install python sdk app as well) and try out the linear regression model. Intercept, R2 are all available features in the Splunk MLTK app.
My concern is that are you are using 10 samples to make a prediction? If so, your model won't be valid. You need samples size in thousands or at least around 300-500

0 Karma