Custom algorithm template
You can use the following custom algorithm template to help get you started with adding a custom algorithm to MLTK.
BaseAlgo class
From base import BaseAlgo
.
class CustomAlgoTemplate(BaseAlgo): def __init__(self, options): # Option checking & initializations here pass def fit(self, df, options): # Fit an estimator to df, a pandas DataFrame of the search results pass def partial_fit(self, df, options): # Incrementally fit a model pass def apply(self, df, options): # Apply a saved model # Modify df, a pandas DataFrame of the search results return df @staticmethod def register_codecs(): # Add codecs to the codec manager pass
Using the Basealgo template in a search, reflects the input data back to the search as shown in the following example.
| fit CustomAlgoTemplate *
These are all described in detail in the $SPLUNK_HOME/etc/apps/Splunk_ML_Toolkit/bin/base.py
BaseAlgo class as shown below.
Write a Python algorithm class | Running process and method calling conventions |
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
Feedback submitted, thanks!