Skip to content

Commit 3070ece

Browse files
committed
Fix for weight file name when we do not save the model
1 parent 67ad2c2 commit 3070ece

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

tmva/tmva/src/MethodBase.cxx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,10 +1957,12 @@ TDirectory* TMVA::MethodBase::BaseDir() const
19571957
sdir = methodDir->mkdir(defaultDir);
19581958
sdir->cd();
19591959
// write weight file name into target file
1960-
TObjString wfilePath( gSystem->WorkingDirectory() );
1961-
TObjString wfileName( GetWeightFileName() );
1962-
wfilePath.Write( "TrainingPath" );
1963-
wfileName.Write( "WeightFileName" );
1960+
if (fModelPersistence) {
1961+
TObjString wfilePath( gSystem->WorkingDirectory() );
1962+
TObjString wfileName( GetWeightFileName() );
1963+
wfilePath.Write( "TrainingPath" );
1964+
wfileName.Write( "WeightFileName" );
1965+
}
19641966
}
19651967

19661968
Log()<<kDEBUG<<Form("Dataset[%s] : ",DataInfo().GetName())<<" Base Directory for " << GetMethodTypeName() << " existed, return it.." <<Endl;
@@ -2026,11 +2028,13 @@ TString TMVA::MethodBase::GetWeightFileName() const
20262028
// directory/jobname_methodname_suffix.extension.{root/txt}
20272029
TString suffix = "";
20282030
TString wFileDir(GetWeightFileDir());
2031+
TString wFileName = GetJobName() + "_" + GetMethodName() +
2032+
suffix + "." + gConfig().GetIONames().fWeightFileExtension + ".xml";
2033+
if (wFileDir.IsNull() ) return wFileName;
2034+
// add weight file directory of it is not null
20292035
return ( wFileDir + (wFileDir[wFileDir.Length()-1]=='/' ? "" : "/")
2030-
+ GetJobName() + "_" + GetMethodName() +
2031-
suffix + "." + gConfig().GetIONames().fWeightFileExtension + ".xml" );
2036+
+ wFileName );
20322037
}
2033-
20342038
////////////////////////////////////////////////////////////////////////////////
20352039
/// writes all MVA evaluation histograms to file
20362040

0 commit comments

Comments
 (0)