4.4 KiB
MLTK Showcases
The MLTK Showcase is a set of example Assistant configurations used to demonstrate MLTK use-cases, organized by Assistant, with an additional filter for user role (e.g., Security or IoT).
Adding Showcases to the MLTK
- If your dataset is not already available, add it to
src/main/resources/splunk/lookups.- if you do this, add documentation about this dataset to
src/main/resources/splunk/lookups/docs
- if you do this, add documentation about this dataset to
- Generate a JSON object representing your showcase. If you're familar with the structure, you can do this manually, or you can follow the steps to generate this object in the [Generating a Showcase Using an Experiment] section below.
- Once you have Showcase JSON, find the appropriate Showcase file here:
src/main/webapp/data/showcases. - Add your Showcase JSON to that file under a key of your choice.
- the key should be unique, unambigious, and 1-3 words long
- Add the Showcase info to
src/main/webapp/data/showcaseInfo.json.- add it to the
assistants.<YOUR_SHOWCASE>.examplessection - the key should be a snake-case version of your key from step 4
- i.e., if your key in step 4 was
My Showcaseyour key in this file should bemy_showcase - the
namemust be the same as the key from step 4 - the
labelmust match yourtitlefrom the Showcase JSON file in step 4
- i.e., if your key in step 4 was
- add it to the
- Register your showcase to the desired roles - under
assistants.<YOUR_SHOWCASE>.showcases, for each of the existing roles, add your key from step 5 to theexampleslist. - You're done! Rebuild the MLTK and your new Showcase should be visible on the
Showcasespage.
Generating a Showcase Using an Experiment
If you don't want to generate your Experiment JSON yourself, you can use the MLTK Experiment UI to generate it.
-
Load the MLTK and navigate to the Experiments list.
-
Create a new Experiment.
- make sure Experiment Type matches your desired Showcase
- the Experiment Title will be your Showcase title
-
Fill in the desired fields in the Experiment.
-
Click the "Submit" button (i.e., "Fit Model", "Detect Outliers", etc.)
-
Validate the results - if the results aren't what you want, adjust your settings in step 4.
-
To generate Experiment JSON, you need to run some JS code in one of the two following ways:
-
Create a bookmarklet with the following code, then click it while on the Experiment page:
javascript:void%20function(){$.ajax(window.location.origin+%22/en-US/splunkd/__raw/%22+decodeURIComponent(window.location.search).substr(14)).then(function(response){const%20parsed=JSON.parse(response),content=parsed.entry[0].content,showcase={title:content.title,type:content.type,dataSource:content.dataSource.length%3E0%3FJSON.parse(content.dataSource):%22%22,searchStages:content.searchStages.length%3E0%3FJSON.parse(content.searchStages):%22%22};window.open().document.body.innerHTML=%22%3Cpre%3E%22+JSON.stringify(showcase,null,4)+%22%3C/pre%3E%22})}(); -
While on the Experiment page, open your JS console and paste in the following:
$.ajax(window.location.origin + '/en-US/splunkd/__raw/' + decodeURIComponent(window.location.search).substr(14)).then(function (response) { const parsed = JSON.parse(response); const content = parsed.entry[0].content; const showcase = { title: content.title, type: content.type, dataSource: content.dataSource.length > 0 ? JSON.parse(content.dataSource) : '', searchStages: content.searchStages.length > 0 ? JSON.parse(content.searchStages) : '' }; window.open().document.body.innerHTML = '<pre>' + JSON.stringify(showcase, null, 4) + '</pre>'; });
-
-
Either way, a new window will open with your Showcase JSON - copy it to a tex editor.
-
In each of your SearchStages, rename your
modelNameif it exists- it's going to be based on the Experiment GUID, for example:
_exp_32c3418b9c6f4c4699e226c2df56a0a5 - replace it with a human-readable name starting with
example_ - i.e., if you intend to name your Showcase
My Showcase, your model name should beexample_my_showcase - for all
preprocessingstages, keep the suffix - for example,_exp_32c3418b9c6f4c4699e226c2df56a0a5_StandardScaler_0should be replaced withexample_my_showcase_StandardScaler_0
- it's going to be based on the Experiment GUID, for example:
-
You can now use this JSON in the [Adding Showcases to the MLTK] section above.