54 RMethodBase(jobName,
Types::kRSVM, methodTitle, dsi, theOption, theTargetDir),
58 asfactor("
as.factor"),
64 fType =
"C-classification";
68 fGamma = (fDfTrain.GetNcols() == 1) ? 1.0 : (1.0 / fDfTrain.GetNcols());
79 SetWeightFileDir(
gConfig().GetIONames().fWeightFileDir);
88 asfactor(
"as.factor"),
94 fType =
"C-classification";
131 Error(
"Init",
"R's package e1071 can not be loaded.");
132 Log() <<
kFATAL <<
" R's package e1071 can not be loaded."
140 if (
Data()->GetNTrainingEvents() == 0)
Log() <<
kFATAL <<
"<Train> Data() has zero events" <<
Endl;
170 r[
"RSVMModel"] << Model;
171 r <<
"save(RSVMModel,file='" + path +
"')";
179 ‘scale’ is of length 1, the value is recycled as many times \
180 as needed. Per default, data are scaled internally (both ‘x’\
181 and ‘y’ variables) to zero mean and unit variance. The center \
182 and scale values are returned and used for later predictions.");
184 regression machine, or for novelty detection. Depending of\
185 whether ‘y’ is a factor or not, the default setting for\
186 ‘type’ is ‘C-classification’ or ‘eps-regression’,\
187 respectively, but may be overwritten by setting an explicit value.\
189 - ‘C-classification’\
190 - ‘nu-classification’\
191 - ‘one-classification’ (for novelty detection)\
195 consider changing some of the following parameters, depending on the kernel type.\
197 polynomial: (gamma*u'*v + coef0)^degree\
198 radial basis: exp(-gamma*|u-v|^2)\
199 sigmoid: tanh(gamma*u'*v + coef0)");
201 DeclareOptionRef(
fGamma,
"Gamma",
"parameter needed for all kernels except ‘linear’ (default:1/(data dimension))");
202 DeclareOptionRef(
fCoef0,
"Coef0",
"parameter needed for kernels of type ‘polynomial’ and ‘sigmoid’ (default: 0)");
203 DeclareOptionRef(
fCost,
"Cost",
"cost of constraints violation (default: 1)-it is the ‘C’-constant of the regularization term in the Lagrange formulation.");
204 DeclareOptionRef(
fNu,
"Nu",
"parameter needed for ‘nu-classification’, ‘nu-regression’,and ‘one-classification’");
209 DeclareOptionRef(
fCross,
"Cross",
"if a integer value k>0 is specified, a k-fold cross validation on the training data is performed to assess the\
210 quality of the model: the accuracy rate for classification and the Mean Squared Error for regression");
212 DeclareOptionRef(
fFitted,
"Fitted",
"logical indicating whether the fitted values should be computed and included in the model or not (default: ‘TRUE’)");
220 r[
"RMVA.RSVM.Type"] =
fType;
225 r[
"RMVA.RSVM.Cost"] =
fCost;
226 r[
"RMVA.RSVM.Nu"] =
fNu;
240 Log() <<
kINFO <<
"Testing Classification RSVM METHOD " <<
Endl;
254 for (
UInt_t i = 0; i < nvar; i++) {
263 mvaValue = values[0];
272 TString path = GetWeightFileDir() +
"/RSVMModel.RData";
276 r <<
"load('" + path +
"')";
278 r[
"RSVMModel"] >> Model;
293 Log() <<
"Decision Trees and Rule-Based Models " <<
Endl;
MethodRSVM(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="", TDirectory *theTargetDir=NULL)
const TString & GetWeightFileDir() const
MsgLogger & Endl(MsgLogger &ml)
Namespace for new ROOT classes and functions.
OptionBase * DeclareOptionRef(T &ref, const TString &name, const TString &desc="")
ROOT::R::TRObject * fModel
UInt_t GetNVariables() const
ROOT::R::TRFunctionImport asfactor
Long64_t GetNEvtBkgdTrain()
return number of background training events in dataset
ROOT::R::TRFunctionImport svm
TRObject GetAttribute(const TString name)
The R objects can to have associate attributes with this method you can added attribute to TRObject g...
ROOT::R::TRFunctionImport predict
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Bool_t Require(TString pkg)
Method to load an R's package.
This is a class to get ROOT's objects from R's objects
std::vector< std::string > fFactorTrain
int GetNcols()
Method to get the number of colunms.
const Event * GetEvent() const
Double_t GetMvaValue(Double_t *errLower=0, Double_t *errUpper=0)
static Bool_t IsModuleLoaded
Describe directory structure in memory.
Long64_t GetNEvtSigTrain()
return number of signal training events in dataset
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets)
static TRInterface & Instance()
static method to get an TRInterface instance reference
DataSetInfo & DataInfo() const
void GetHelpMessage() const
#define REGISTER_METHOD(CLASS)
for example
Abstract ClassifierFactory template that handles arbitrary types.
std::vector< Float_t > & GetValues()
ROOT::R::TRDataFrame fDfTrain
virtual void TestClassification()
initialization
void SetWeightFileDir(TString fileDir)
set directory of weight file
std::vector< TString > GetListOfVariables() const
returns list of variables
Rcpp::internal::NamedPlaceHolder Label
virtual void TestClassification()
initialization
void NoErrorCalc(Double_t *const err, Double_t *const errUpper)
This is a class to create DataFrames from ROOT to R