Register an algorithm in the Machine Learning Toolkit
In order to use an algorithm in Splunk Machine Learning Toolkit and for it to be visible in the Splunk platform, you must register the algorithm in the MLTK app. You can register the name of an algorithm by manual file update or with the REST API.
To register an algorithm, update the
algos.conf file with the name of the algorithm you want to add.
Register by manual file update
Use the following steps to register the name of an algorithm by manual file update.
- Create or update
algos.confin the following directory:
- Add the algorithm name as a stanza, meaning within brackets, to the
[<Your new algorithm class name>]
- Click Save.
- Restart Splunk Enterprise.
Register with the REST API
You can use the following code to register the name of an algorithm with the REST API. You need administrator permissions in order to use this method.
$ curl -k -u admin:<admin pass> https://localhost:8089/servicesNS/nobody/Splunk_ML_Toolkit/configs/conf-algos -d name="<Your new algorithm class name>"
Implement the algorithm
To implement the algorithm, create and name a python script file (.py file) for the algorithm in the following directory:
The name of the .py file and the name of the main class in the .py file must be the same as the stanza name, the name in brackets, used in the
algos.conf file. For example,
[LinearRegression] for the LinearRegression algorithm.
<Your new algorithm class name>.py
The name of the algorithm class must be unique and not conflict with other names in the
Add a custom algorithm to the Machine Learning Toolkit overview
Write a Python algorithm class
This documentation applies to the following versions of Splunk® Machine Learning Toolkit: 4.4.0, 4.4.1, 4.4.2, 4.5.0, 5.0.0, 5.1.0, 5.2.0, 5.2.1, 5.2.2, 5.3.0, 5.3.1, 5.3.3, 5.4.0, 5.4.1