Is it possible to save TMVA data after training (dataset folder) not in the current dir?

I am using TMVA methods for classification.
If I write

    TMVA::DataLoader* dataloader = new TMVA::DataLoader( "../Data/1400/TMVA/Training/dataset" );

I see then after all processes that there is folder dataset with weights etc. inside. BUT. At the end of my macro I launch GUI:

    if ( !gROOT->IsBatch() )
    {
        TMVA::TMVAGui( "../Data/1400/TMVA/ClassificationOut.root" );
    }

It appears but when I try to use it pushing the buttons I get messages like

— Found 0 classifier types
ups … no methods found in to plot ROC curve for … give up

But if I wrote instead of the above:

 TMVA::DataLoader* dataloader = new TMVA::DataLoader( "dataset" );

it would work perfectly. What is going on?
By the way even visually the start pages of GUIs are different:
1 2

Hi,

The name of the dataset should be an identifier, not a path. Because of how the name is treated internally it will mess up the GUI code if there are non-filename characters in it.

TMVA assumes that the output should be written to the current directory. You can always move the generated folders via scripts as a workaround.

I usually run the scripts “the other way around” when I want output at a specific location e.g.

cd ./path/for/output
root -l ../../path/to/scripts

Cheers,
Kim

What if I have some process (say MainProcess.C) that includes TMVA training and application processes and I need loop this process over some data array which assumes the creation (or recreation if exists) new folder for each data entry. So I want “dataset” to be in a corresponding folder. I do not want to run MainProcess.C every time from new dir (at least not by hand). What am I suppose to do in this case.

Thanks in advance.

What I did last time was to create a Python wrapper that runs the training script in a scratch area and then moves the result to the desired final location.

Sketch of the python script below. Missing error handling, command line arguments and possibly more.

import argparse
import subprocess
import os

script_path = 'path/to/training/script'
job_name = 'job_name'
final_dir = 'some/path'

scratch_dir = 'path/to/working/dir'

os.chdir(scratch_dir)
subprocess.call('root -l {}'.format(script_path))

os.rename('{}'.format(scratch_dir), '{}/{}'.format(final_dir, job_name))

With the argparse module it is quite easy to make a script that will loop over a set of training/application scripts. os.makedirs could also be useful.

If you end up doing something else, please outline the approach so others can learn :slight_smile:

Cheers,
Kim