// This macro plots the distributions of the different input variables overlaid on // the sum of importance per bin. // The scale goes from violett (no importance) to red (high importance). // Areas where many important rules are active, will thus be very red. // // input: - Input file (result from TMVA), // - normal/decorrelated/PCA // - use of TMVA plotting TStyle void rulevisHists( TString fin = "TMVA.root", TMVAGlob::TypeOfPlot type = TMVAGlob::kNormal, bool useTMVAStyle=kTRUE ) { // set style and remove existing canvas' TMVAGlob::Initialize( useTMVAStyle ); // checks if file with name "fin" is already open, and if not opens one TFile *file = TMVAGlob::OpenFile( fin ); // get all titles of the method rulefit TList titles; UInt_t ninst = TMVAGlob::GetListOfTitles("Method_RuleFit",titles); if (ninst==0) return; // get top dir containing all hists of the variables TDirectory* vardir = TMVAGlob::GetInputVariablesDir( type ); if (vardir==0) return; TDirectory* corrdir = TMVAGlob::GetCorrelationPlotsDir( type, vardir ); if (corrdir==0) return; // loop over all titles TIter keyIter(&titles); TDirectory *rfdir; TKey *rfkey; while ((rfkey = TMVAGlob::NextKey(keyIter,"TDirectory"))) { rfdir = (TDirectory *)rfkey->ReadObj(); rulevisHists( rfdir, vardir, corrdir, type ); } }
// writes to fav file void JobManagerPrivate::saveFavorites() { qDebug()<<Q_FUNC_INFO<<favs.size(); QFile f(favFilePath()); // TODO: Should we delete this file before using ? if(!f.open(QIODevice::WriteOnly)) { qWarning()<<Q_FUNC_INFO<<"Unable to open file in write mode: "<<favFilePath(); return; } QXmlStreamWriter writer(&f); writer.setAutoFormatting(true); writer.writeStartDocument(); writer.writeStartElement(FAV_XML_ROOT); QListIterator< QVariantMap > iter(favs); while(iter.hasNext()) { writer.writeStartElement(FAV_XML_ITEM); QVariantMap key = iter.next(); QMapIterator< QString,QVariant > keyIter(key); while(keyIter.hasNext()) { keyIter.next(); writer.writeTextElement(keyIter.key(),keyIter.value().toString()); } writer.writeEndElement(); // closing itemb } writer.writeEndElement(); writer.writeEndDocument(); f.close(); }
void likelihoodrefs( TString fin = "TMVA.root", Bool_t useTMVAStyle = kTRUE ) { // set style and remove existing canvas' TMVAGlob::Initialize( useTMVAStyle ); // checks if file with name "fin" is already open, and if not opens one TFile* file = TMVAGlob::OpenFile( fin ); // get all titles of the method likelihood TList titles; TString metlike="Method_Likelihood"; UInt_t ninst = TMVAGlob::GetListOfTitles(metlike,titles); if (ninst==0) { cout << "Could not locate directory 'Method_Likelihood' in file " << fin << endl; return; } // loop over all titles TIter keyIter(&titles); TDirectory *lhdir; TKey *key; while ((key = TMVAGlob::NextKey(keyIter,"TDirectory"))) { lhdir = (TDirectory *)key->ReadObj(); likelihoodrefs( lhdir ); } }