Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMVA::RuleFitAPI Class Reference

J Friedman's RuleFit method.

Definition at line 51 of file RuleFitAPI.h.

Classes

struct  IntParms
 
struct  RealParms
 

Public Member Functions

 RuleFitAPI (const TMVA::MethodRuleFit *rfbase, TMVA::RuleFit *rulefit, EMsgType minType)
 
virtual ~RuleFitAPI ()
 destructor
 
void CheckRFWorkDir ()
 check if the rulefit work dir is properly setup.
 
const TString GetRFWorkDir () const
 
void HowtoSetupRF ()
 howto message
 
virtual TClassIsA () const
 
Bool_t ReadModelSum ()
 read model from rulefit.sum
 
void SetRFWorkDir (const char *wdir)
 set the directory containing rf_go.exe.
 
virtual void Streamer (TBuffer &)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
void TestRuleFit ()
 
void TrainRuleFit ()
 
void VarImp ()
 
void WelcomeMessage ()
 welcome message
 

Static Public Member Functions

static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 

Protected Types

enum  EModel { kRfLinear =0 , kRfRules =1 , kRfBoth =2 }
 
enum  ERFMode { kRfRegress =1 , kRfClass =2 }
 
enum  ERFProgram { kRfTrain =0 , kRfPredict , kRfVarimp }
 

Protected Member Functions

void FillIntParmsDef ()
 set default int params
 
void FillRealParmsDef ()
 set default real params
 
TString GetRFName (TString name)
 
void ImportSetup ()
 import setup from MethodRuleFit
 
void InitRuleFit ()
 default initialisation SetRFWorkDir("./rulefit");
 
Bool_t OpenRFile (TString name, std::ifstream &f)
 
Bool_t OpenRFile (TString name, std::ofstream &f)
 
Int_t ReadFloat (std::ifstream &f, Float_t *v, Int_t n=1) const
 
Int_t ReadInt (std::ifstream &f, Int_t *v, Int_t n=1) const
 
Bool_t ReadIntParms ()
 
Bool_t ReadLx ()
 
Bool_t ReadProgram ()
 
Bool_t ReadRealParms ()
 
Bool_t ReadRealVarImp ()
 
Bool_t ReadRfOut ()
 
Bool_t ReadRfStatus ()
 
Bool_t ReadRuleFitMod ()
 
Bool_t ReadRuleFitSum ()
 
Bool_t ReadTrainW ()
 
Bool_t ReadTrainX ()
 
Bool_t ReadTrainY ()
 
Bool_t ReadVarImp ()
 read variable importance
 
Bool_t ReadVarNames ()
 
Bool_t ReadYhat ()
 read the score
 
Int_t RunRuleFit ()
 execute rf_go.exe
 
void SetRFPredict ()
 
void SetRFTrain ()
 
void SetRFVarimp ()
 
void SetTestParms ()
 set the test params
 
void SetTrainParms ()
 set the training parameters
 
Bool_t WriteAll ()
 write all files read by rf_go.exe
 
Bool_t WriteFloat (std::ofstream &f, const Float_t *v, Int_t n=1)
 
Bool_t WriteInt (std::ofstream &f, const Int_t *v, Int_t n=1)
 
Bool_t WriteIntParms ()
 write int params file
 
Bool_t WriteLx ()
 Save input variable mask.
 
Bool_t WriteProgram ()
 write command to rf_go.exe
 
Bool_t WriteRealParms ()
 write int params file
 
Bool_t WriteRealVarImp ()
 write the minimum importance to be considered
 
Bool_t WriteRfOut ()
 written by rf_go.exe; write rulefit output (rfout)
 
Bool_t WriteRfStatus ()
 written by rf_go.exe; write rulefit status
 
Bool_t WriteRuleFitMod ()
 written by rf_go.exe (NOTE:Format unknown!)
 
Bool_t WriteRuleFitSum ()
 written by rf_go.exe (NOTE: format unknown!)
 
Bool_t WriteTest ()
 Write test data.
 
Bool_t WriteTrain ()
 write training data, column wise
 
Bool_t WriteVarImp ()
 
Bool_t WriteVarNames ()
 write variable names, ascii
 
Bool_t WriteYhat ()
 written by rf_go.exe
 

Private Member Functions

 RuleFitAPI ()
 

Private Attributes

MsgLogger fLogger
 ! message logger
 
const MethodRuleFitfMethodRuleFit
 parent method - set in constructor
 
TString fModelType
 model type string
 
IntParms fRFIntParms
 integer parameters
 
std::vector< intfRFLx
 variable selector
 
ERFProgram fRFProgram
 what to run
 
RealParms fRFRealParms
 real parameters
 
std::vector< Float_tfRFVarImp
 variable importances
 
std::vector< Int_tfRFVarImpInd
 variable index
 
TString fRFWorkDir
 working directory
 
std::vector< Float_tfRFYhat
 score results from test sample
 
RuleFitfRuleFit
 non const ptr to RuleFit class in MethodRuleFit
 

#include <TMVA/RuleFitAPI.h>

Member Enumeration Documentation

◆ EModel

enum TMVA::RuleFitAPI::EModel
protected
Enumerator
kRfLinear 
kRfRules 
kRfBoth 

Definition at line 85 of file RuleFitAPI.h.

◆ ERFMode

enum TMVA::RuleFitAPI::ERFMode
protected
Enumerator
kRfRegress 
kRfClass 

Definition at line 84 of file RuleFitAPI.h.

◆ ERFProgram

Enumerator
kRfTrain 
kRfPredict 
kRfVarimp 

Definition at line 86 of file RuleFitAPI.h.

Constructor & Destructor Documentation

◆ RuleFitAPI() [1/2]

TMVA::RuleFitAPI::RuleFitAPI ( const TMVA::MethodRuleFit rfbase,
TMVA::RuleFit rulefit,
EMsgType  minType = kINFO 
)

Definition at line 48 of file RuleFitAPI.cxx.

◆ ~RuleFitAPI()

TMVA::RuleFitAPI::~RuleFitAPI ( )
virtual

destructor

Definition at line 69 of file RuleFitAPI.cxx.

◆ RuleFitAPI() [2/2]

TMVA::RuleFitAPI::RuleFitAPI ( )
private

Member Function Documentation

◆ CheckRFWorkDir()

void TMVA::RuleFitAPI::CheckRFWorkDir ( )

check if the rulefit work dir is properly setup.

it aborts (kFATAL) if not.

Check existence of directory

Definition at line 166 of file RuleFitAPI.cxx.

◆ Class()

static TClass * TMVA::RuleFitAPI::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

static const char * TMVA::RuleFitAPI::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

static constexpr Version_t TMVA::RuleFitAPI::Class_Version ( )
inlinestaticconstexpr
Returns
Version of this class

Definition at line 195 of file RuleFitAPI.h.

◆ DeclFileName()

static const char * TMVA::RuleFitAPI::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 195 of file RuleFitAPI.h.

◆ FillIntParmsDef()

void TMVA::RuleFitAPI::FillIntParmsDef ( )
protected

set default int params

Definition at line 228 of file RuleFitAPI.cxx.

◆ FillRealParmsDef()

void TMVA::RuleFitAPI::FillRealParmsDef ( )
protected

set default real params

Definition at line 213 of file RuleFitAPI.cxx.

◆ GetRFName()

TString TMVA::RuleFitAPI::GetRFName ( TString  name)
inlineprotected

Definition at line 231 of file RuleFitAPI.h.

◆ GetRFWorkDir()

const TString TMVA::RuleFitAPI::GetRFWorkDir ( ) const
inline

Definition at line 80 of file RuleFitAPI.h.

◆ HowtoSetupRF()

void TMVA::RuleFitAPI::HowtoSetupRF ( )

howto message

Definition at line 92 of file RuleFitAPI.cxx.

◆ ImportSetup()

void TMVA::RuleFitAPI::ImportSetup ( )
protected

import setup from MethodRuleFit

Definition at line 132 of file RuleFitAPI.cxx.

◆ InitRuleFit()

void TMVA::RuleFitAPI::InitRuleFit ( )
protected

default initialisation SetRFWorkDir("./rulefit");

Definition at line 122 of file RuleFitAPI.cxx.

◆ IsA()

virtual TClass * TMVA::RuleFitAPI::IsA ( ) const
inlinevirtual
Returns
TClass describing current object

Definition at line 195 of file RuleFitAPI.h.

◆ OpenRFile() [1/2]

Bool_t TMVA::RuleFitAPI::OpenRFile ( TString  name,
std::ifstream &  f 
)
inlineprotected

Definition at line 252 of file RuleFitAPI.h.

◆ OpenRFile() [2/2]

Bool_t TMVA::RuleFitAPI::OpenRFile ( TString  name,
std::ofstream &  f 
)
inlineprotected

Definition at line 238 of file RuleFitAPI.h.

◆ ReadFloat()

Int_t TMVA::RuleFitAPI::ReadFloat ( std::ifstream &  f,
Float_t v,
Int_t  n = 1 
) const
inlineprotected

Definition at line 291 of file RuleFitAPI.h.

◆ ReadInt()

Int_t TMVA::RuleFitAPI::ReadInt ( std::ifstream &  f,
Int_t v,
Int_t  n = 1 
) const
inlineprotected

Definition at line 282 of file RuleFitAPI.h.

◆ ReadIntParms()

Bool_t TMVA::RuleFitAPI::ReadIntParms ( )
protected

◆ ReadLx()

Bool_t TMVA::RuleFitAPI::ReadLx ( )
protected

◆ ReadModelSum()

Bool_t TMVA::RuleFitAPI::ReadModelSum ( )

read model from rulefit.sum

Definition at line 544 of file RuleFitAPI.cxx.

◆ ReadProgram()

Bool_t TMVA::RuleFitAPI::ReadProgram ( )
protected

◆ ReadRealParms()

Bool_t TMVA::RuleFitAPI::ReadRealParms ( )
protected

◆ ReadRealVarImp()

Bool_t TMVA::RuleFitAPI::ReadRealVarImp ( )
protected

◆ ReadRfOut()

Bool_t TMVA::RuleFitAPI::ReadRfOut ( )
protected

◆ ReadRfStatus()

Bool_t TMVA::RuleFitAPI::ReadRfStatus ( )
protected

◆ ReadRuleFitMod()

Bool_t TMVA::RuleFitAPI::ReadRuleFitMod ( )
protected

◆ ReadRuleFitSum()

Bool_t TMVA::RuleFitAPI::ReadRuleFitSum ( )
protected

◆ ReadTrainW()

Bool_t TMVA::RuleFitAPI::ReadTrainW ( )
protected

◆ ReadTrainX()

Bool_t TMVA::RuleFitAPI::ReadTrainX ( )
protected

◆ ReadTrainY()

Bool_t TMVA::RuleFitAPI::ReadTrainY ( )
protected

◆ ReadVarImp()

Bool_t TMVA::RuleFitAPI::ReadVarImp ( )
protected

read variable importance

Definition at line 507 of file RuleFitAPI.cxx.

◆ ReadVarNames()

Bool_t TMVA::RuleFitAPI::ReadVarNames ( )
protected

◆ ReadYhat()

Bool_t TMVA::RuleFitAPI::ReadYhat ( )
protected

read the score

Definition at line 482 of file RuleFitAPI.cxx.

◆ RunRuleFit()

Int_t TMVA::RuleFitAPI::RunRuleFit ( )
protected

execute rf_go.exe

Definition at line 771 of file RuleFitAPI.cxx.

◆ SetRFPredict()

void TMVA::RuleFitAPI::SetRFPredict ( )
inlineprotected

Definition at line 129 of file RuleFitAPI.h.

◆ SetRFTrain()

void TMVA::RuleFitAPI::SetRFTrain ( )
inlineprotected

Definition at line 128 of file RuleFitAPI.h.

◆ SetRFVarimp()

void TMVA::RuleFitAPI::SetRFVarimp ( )
inlineprotected

Definition at line 130 of file RuleFitAPI.h.

◆ SetRFWorkDir()

void TMVA::RuleFitAPI::SetRFWorkDir ( const char *  wdir)

set the directory containing rf_go.exe.

Definition at line 155 of file RuleFitAPI.cxx.

◆ SetTestParms()

void TMVA::RuleFitAPI::SetTestParms ( )
protected

set the test params

Definition at line 201 of file RuleFitAPI.cxx.

◆ SetTrainParms()

void TMVA::RuleFitAPI::SetTrainParms ( )
protected

set the training parameters

Definition at line 188 of file RuleFitAPI.cxx.

◆ Streamer()

virtual void TMVA::RuleFitAPI::Streamer ( TBuffer )
virtual

◆ StreamerNVirtual()

void TMVA::RuleFitAPI::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 195 of file RuleFitAPI.h.

◆ TestRuleFit()

void TMVA::RuleFitAPI::TestRuleFit ( )
inline

Definition at line 211 of file RuleFitAPI.h.

◆ TrainRuleFit()

void TMVA::RuleFitAPI::TrainRuleFit ( )
inline

Definition at line 202 of file RuleFitAPI.h.

◆ VarImp()

void TMVA::RuleFitAPI::VarImp ( )
inline

Definition at line 221 of file RuleFitAPI.h.

◆ WelcomeMessage()

void TMVA::RuleFitAPI::WelcomeMessage ( )

welcome message

Definition at line 76 of file RuleFitAPI.cxx.

◆ WriteAll()

Bool_t TMVA::RuleFitAPI::WriteAll ( )
protected

write all files read by rf_go.exe

Definition at line 248 of file RuleFitAPI.cxx.

◆ WriteFloat()

Bool_t TMVA::RuleFitAPI::WriteFloat ( std::ofstream &  f,
const Float_t v,
Int_t  n = 1 
)
inlineprotected

Definition at line 274 of file RuleFitAPI.h.

◆ WriteInt()

Bool_t TMVA::RuleFitAPI::WriteInt ( std::ofstream &  f,
const Int_t v,
Int_t  n = 1 
)
inlineprotected

Definition at line 266 of file RuleFitAPI.h.

◆ WriteIntParms()

Bool_t TMVA::RuleFitAPI::WriteIntParms ( )
protected

write int params file

Definition at line 264 of file RuleFitAPI.cxx.

◆ WriteLx()

Bool_t TMVA::RuleFitAPI::WriteLx ( )
protected

Save input variable mask.

If the lx vector size is not the same as inputVars, resize it and fill it with 1 NOTE: Always set all to 1 if (fRFLx.size() != m_inputVars->size()) {

Definition at line 291 of file RuleFitAPI.cxx.

◆ WriteProgram()

Bool_t TMVA::RuleFitAPI::WriteProgram ( )
protected

write command to rf_go.exe

Definition at line 305 of file RuleFitAPI.cxx.

◆ WriteRealParms()

Bool_t TMVA::RuleFitAPI::WriteRealParms ( )
protected

write int params file

Definition at line 275 of file RuleFitAPI.cxx.

◆ WriteRealVarImp()

Bool_t TMVA::RuleFitAPI::WriteRealVarImp ( )
protected

write the minimum importance to be considered

Definition at line 333 of file RuleFitAPI.cxx.

◆ WriteRfOut()

Bool_t TMVA::RuleFitAPI::WriteRfOut ( )
protected

written by rf_go.exe; write rulefit output (rfout)

Definition at line 347 of file RuleFitAPI.cxx.

◆ WriteRfStatus()

Bool_t TMVA::RuleFitAPI::WriteRfStatus ( )
protected

written by rf_go.exe; write rulefit status

Definition at line 356 of file RuleFitAPI.cxx.

◆ WriteRuleFitMod()

Bool_t TMVA::RuleFitAPI::WriteRuleFitMod ( )
protected

written by rf_go.exe (NOTE:Format unknown!)

Definition at line 365 of file RuleFitAPI.cxx.

◆ WriteRuleFitSum()

Bool_t TMVA::RuleFitAPI::WriteRuleFitSum ( )
protected

written by rf_go.exe (NOTE: format unknown!)

Definition at line 374 of file RuleFitAPI.cxx.

◆ WriteTest()

Bool_t TMVA::RuleFitAPI::WriteTest ( )
protected

Write test data.

Definition at line 418 of file RuleFitAPI.cxx.

◆ WriteTrain()

Bool_t TMVA::RuleFitAPI::WriteTrain ( )
protected

write training data, column wise

Definition at line 383 of file RuleFitAPI.cxx.

◆ WriteVarImp()

Bool_t TMVA::RuleFitAPI::WriteVarImp ( )
protected

Definition at line 462 of file RuleFitAPI.cxx.

◆ WriteVarNames()

Bool_t TMVA::RuleFitAPI::WriteVarNames ( )
protected

write variable names, ascii

Definition at line 450 of file RuleFitAPI.cxx.

◆ WriteYhat()

Bool_t TMVA::RuleFitAPI::WriteYhat ( )
protected

written by rf_go.exe

Definition at line 473 of file RuleFitAPI.cxx.

Member Data Documentation

◆ fLogger

MsgLogger TMVA::RuleFitAPI::fLogger
mutableprivate

! message logger

Definition at line 193 of file RuleFitAPI.h.

◆ fMethodRuleFit

const MethodRuleFit* TMVA::RuleFitAPI::fMethodRuleFit
private

parent method - set in constructor

Definition at line 180 of file RuleFitAPI.h.

◆ fModelType

TString TMVA::RuleFitAPI::fModelType
private

model type string

Definition at line 191 of file RuleFitAPI.h.

◆ fRFIntParms

IntParms TMVA::RuleFitAPI::fRFIntParms
private

integer parameters

Definition at line 187 of file RuleFitAPI.h.

◆ fRFLx

std::vector<int> TMVA::RuleFitAPI::fRFLx
private

variable selector

Definition at line 189 of file RuleFitAPI.h.

◆ fRFProgram

ERFProgram TMVA::RuleFitAPI::fRFProgram
private

what to run

Definition at line 190 of file RuleFitAPI.h.

◆ fRFRealParms

RealParms TMVA::RuleFitAPI::fRFRealParms
private

real parameters

Definition at line 188 of file RuleFitAPI.h.

◆ fRFVarImp

std::vector<Float_t> TMVA::RuleFitAPI::fRFVarImp
private

variable importances

Definition at line 184 of file RuleFitAPI.h.

◆ fRFVarImpInd

std::vector<Int_t> TMVA::RuleFitAPI::fRFVarImpInd
private

variable index

Definition at line 185 of file RuleFitAPI.h.

◆ fRFWorkDir

TString TMVA::RuleFitAPI::fRFWorkDir
private

working directory

Definition at line 186 of file RuleFitAPI.h.

◆ fRFYhat

std::vector<Float_t> TMVA::RuleFitAPI::fRFYhat
private

score results from test sample

Definition at line 183 of file RuleFitAPI.h.

◆ fRuleFit

RuleFit* TMVA::RuleFitAPI::fRuleFit
private

non const ptr to RuleFit class in MethodRuleFit

Definition at line 181 of file RuleFitAPI.h.

Libraries for TMVA::RuleFitAPI:

The documentation for this class was generated from the following files: