I'd like to save a separate machine learning model file for each asset in an asset loop using the NEURAL framework in the r.h file. I have some questions that I think would help my understanding of how to achieve this.
If I call adviseLong(NEURAL...) in an asset loop, the framework in the r.h file over writes the .ml file with each iteration of the loop. I'd like to save a separate .ml file for each asset.
Here is the NEURAL_SAVE and NEURAL_LOAD functions from r.h:
if(mode == NEURAL_SAVE)
return Rx(strf("save(Models,file='%s')",slash(Data)),2);
if(mode == NEURAL_LOAD)
return Rx(strf("load('%s')",slash(Data)),2);
return 1;
The line
Rx(strf("save(Models,file='%s')",slash(Data)),2);
saves a .ml file with the name of the script. But how is the name of the script being accessed here since it is not explicitly specified?
If I try
Rx(strf("save(Models,file='%s_%s')", strx(Asset, "/", "_"), slash(Data)),2);
the script tries to save a file with the path Asset_Data/SCRIPT_NAME_1.ml'. Obviously that makes no sense. Likewise if I try
file='%s_%s')", slash(Data)),strx(Asset, "/", "_"),2);
the file path to be saved is Data/SCRIPT_NAME_1.mlASSET'. Again, that makes not much sense.
What am I missing? How can I save a model to a file of the format
Data/SCRIPT_NAME_ASSET_1.ml using the r.h framework?