Reproducing regression results

Hello,
I have trained a MLP network on some data and used the TMVARegGUI to view the resulting reco - truth distribution (getting good results). I now want to test this network on a second set of data, and I’ve made a macro based on TMVARegressionApplication.C that calls EvaluateReression on the events.

However I cannot get my macro to reproduce the reco - truth distribution that TMVA made, even if I used the first set of data used for the training.

I’m new to TMVA, so I don’t really know where to start looking for the source of this problem, so any advice is much welcome!

Below is snippet of the code, responsible for looping over the events:

  data->Draw(">>selection",mycut);
  TEventList *select = (TEventList*)gDirectory->Get("selection");
  data->SetEventList(select);
  Long64_t selected_idx;
    
  std::cout << "--- Processing: " << select->GetN() << " events" << std::endl;

       for (Long64_t idx_sel=0; idx_sel < select->GetN() ;idx_sel++) {

            // Translate from out 
            selected_idx = select->GetEntry(idx_sel);
            data->GetEntry(selected_idx);

            read_NDet_water = (float)log10(NDet_water);
            read_RShowerMax = (float)log10(RShowerMax);
            read_MaxExpRadius = (float)log10(MaxExpRadius);
            read_SCharge = (float)log10(SCharge);
            read_WCharge = (float)log10(WCharge);
            read_wAveChargeGT10m_nkg = (float)log10(wAveChargeGT10m_nkg);
            read_WChargeGT30m = (float)log10(WChargeGT30m);
            read_RSize = (float)log10(RSize);

  // Retrieve the MVA target values (regression outputs) and fill into histograms
  // NOTE: EvaluateRegression(..) returns a vector for multi-target regression

          Float_t reco = (reader->EvaluateRegression( methodName ))[0];
          result->Fill( log10(TrueEnergy), reco -log10(TrueEnergy) );

  }

Superficially, your code looks ok to my eye. Could you post the output plots for comparison?

Cheers,
Kim