Splunk Search

How to Dynamically save model name using a column value?

bhavesh0124
Explorer

Hi I have the following query for training a model. However, I want to save my model name using a single column value that comes from a lookup. In a nutshell, I want to save the model name dynamically.


index = "Abc" 
fields Days, Count, Target
| sample partitions=100
| appendpipe
[ | search partition_number < 90 | fields - partition_number
| fit DecisionTreeRegressor "target" from * splitter=best into "model_name" apply=false ]

So currently the model name is "model_name" but I want it to come from a lookup, where there is single column and a single value. 


@niketn  @gcusello 


Labels (4)
0 Karma

bhavesh0124
Explorer

That worked! Thanks a lot

0 Karma

etoombs
Path Finder

I've never tried to make a model name dynamically,  but have done it with outputlookup - maybe you can do something similar?

| outputlookup
[| makeresults
| eval filename=strftime(relative_time(relative_time(now(),"-1mon@mon"), "@m"), "filename_%B_%Y.csv")
| return $filename]

Something like:

[ | search partition_number < 90 | fields - partition_number
| fit DecisionTreeRegressor "target" from * splitter=best into [|inputlookup xyz output myfieldname|return $myfilename] apply=false ]

Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...