Splunk Search

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

niketn
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

niketn
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
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...