76#ifdef MethodMLP_UseMinuit__
167#ifdef MethodMLP_UseMinuit__
197 "Train with Back-Propagation (BP), BFGS Algorithm (BFGS), or Genetic Algorithm (GA - slower and worse)");
205 DeclareOptionRef(
fEpochMon =
kFALSE,
"EpochMonitoring",
"Provide epoch-wise monitoring plots according to TestRate (caution: causes big ROOT output file!)" );
208 DeclareOptionRef(
fSamplingEpoch=1.0,
"SamplingEpoch",
"Sampling is used for the first 'SamplingEpoch' epochs, afterwards, all events are taken for training");
209 DeclareOptionRef(
fSamplingWeight=1.0,
"SamplingImportance",
" The sampling weights of events in epochs which successful (worse estimator than before) are multiplied with SamplingImportance, else they are divided.");
218 "Back-propagation learning mode: sequential or batch");
223 "Batch size: number of events/batch, only set if in Batch Mode, -1 for BatchSize=number_of_events");
226 "Minimum improvement which counts as improvement (<0 means automatic convergence check is turned off)");
229 "Number of steps (without improvement) required for convergence (<0 means automatic convergence check is turned off)");
232 "Use regulator to avoid over-training");
234 "Maximum times of regulator update");
236 "Calculates inverse Hessian matrix at the end of the training to be able to calculate the uncertainties of an MVA value");
239 "Take the events for the estimator calculations from small deviations from the desired value to large deviations only over the weight range");
253 <<
"Will ignore negative events in training!"
270 if (fBatchSize < 1 || fBatchSize > numEvents)
fBatchSize = numEvents;
279 Log() << kDEBUG <<
"Initialize learning rates" <<
Endl;
282 for (
Int_t i = 0; i < numSynapses; i++) {
295 Log() << kFATAL <<
"<CalculateEstimator> fatal error: wrong tree type: " << treeType <<
Endl;
299 Data()->SetCurrentType(treeType);
311 histS =
new TH1F( nameS, nameS, nbin, -limit, limit );
312 histB =
new TH1F( nameB, nameB, nbin, -limit, limit );
328 for (
Int_t i = 0; i < nEvents; i++) {
344 for (
UInt_t itgt = 0; itgt < nTgts; itgt++) {
355 for (
UInt_t icls = 0; icls < nClasses; icls++) {
357 norm += exp( activationValue );
359 d = exp( activationValue );
364 for (
UInt_t icls = 0; icls < nClasses; icls++) {
365 Double_t desired = (icls==cls) ? 1.0 : 0.0;
367 d = (desired-
v)*(desired-
v);
386 if (
DataInfo().IsSignal(ev) && histS != 0) histS->
Fill(
float(
v),
float(w) );
387 else if (histB != 0) histB->
Fill(
float(
v),
float(w) );
400 float deviation = (*itDev).first;
401 float devWeight = (*itDev).second;
402 weightSum += devWeight;
403 if( weightSum <= weightRangeCut ) {
404 estimator += devWeight*deviation;
408 sumOfWeights = sumOfWeightsInRange;
418 estimator = estimator/
Float_t(sumOfWeights);
423 Data()->SetCurrentType( saveType );
439 Log() << kFATAL <<
"ANN Network is not initialized, doing it now!"<<
Endl;
442 Log() << kDEBUG <<
"reinitialize learning rates" <<
Endl;
449 if (nSynapses>nEvents)
450 Log()<<kWARNING<<
"ANN too complicated: #events="<<nEvents<<
"\t#synapses="<<nSynapses<<
Endl;
454 std::vector<TString> titles = {
"Error on training set",
"Error on test set"};
458#ifdef MethodMLP_UseMinuit__
459 if (useMinuit) MinuitMinimize();
469 Log()<<kINFO<<
"Finalizing handling of Regulator terms, trainE="<<trainE<<
" testE="<<testE<<
Endl;
471 Log()<<kINFO<<
"Done with handling of Regulator terms"<<
Endl;
501 Int_t nWeights = nSynapses;
503 for (
Int_t i=0;i<nSynapses;i++) {
508 std::vector<Double_t> buffer( nWeights );
509 for (
Int_t i=0;i<nWeights;i++) buffer[i] = 0.;
512 TMatrixD Hessian ( nWeights, nWeights );
516 Int_t RegUpdateTimes=0;
527 if (
fSteps > 0)
Log() << kINFO <<
"Inaccurate progress timing for MLP... " <<
Endl;
531 for (
Int_t i = 0; i < nEpochs; i++) {
540 Data()->CreateSampling();
545 Data()->CreateSampling();
551 Data()->InitSampling(1.0,1.0);
553 Data()->InitSampling(1.0,1.0);
577 else SetDir( Hessian, Dir );
592 Log() << kFATAL <<
"Line search failed! Huge troubles somewhere..." <<
Endl;
597 if (dError<0)
Log()<<kWARNING<<
"\nnegative dError=" <<dError<<
Endl;
600 if (
fUseRegulator && RegUpdateTimes<fUpdateLimit && RegUpdateCD>=5 && fabs(dError)<0.1*AccuError) {
601 Log()<<kDEBUG<<
"\n\nUpdate regulators "<<RegUpdateTimes<<
" on epoch "<<i<<
"\tdError="<<dError<<
Endl;
626 Data()->EventResult( success );
652 if (progress2>progress) progress=progress2;
657 if (progress<i) progress=i;
677 for (
Int_t i=0;i<nSynapses;i++) {
679 Gamma[IDX++][0] = -synapse->
GetDEDw();
682 for (
Int_t i=0;i<nWeights;i++) Delta[i][0] = buffer[i];
687 for (
Int_t i=0;i<nSynapses;i++)
690 Gamma[IDX++][0] += synapse->
GetDEDw();
699 for (
Int_t i=0;i<nSynapses;i++) {
705 Int_t nPosEvents = nEvents;
706 for (
Int_t i=0;i<nEvents;i++) {
717 for (
Int_t j=0;j<nSynapses;j++) {
723 for (
Int_t i=0;i<nSynapses;i++) {
727 synapse->
SetDEDw( DEDw / nPosEvents );
742 for (
UInt_t itgt = 0; itgt < ntgt; itgt++) {
750 for (
UInt_t icls = 0; icls < nClasses; icls++) {
751 Double_t desired = ( cls==icls ? 1.0 : 0.0 );
778 for (
Int_t i=0;i<nSynapses;i++) {
780 Dir[IDX++][0] = -synapse->
GetDEDw();
813 for (
Int_t i=0;i<nSynapses;i++) {
815 DEDw[IDX++][0] = synapse->
GetDEDw();
818 dir = Hessian * DEDw;
819 for (
Int_t i=0;i<IDX;i++) dir[i][0] = -dir[i][0];
830 for (
Int_t i=0;i<nSynapses;i++) {
832 Result += Dir[IDX++][0] * synapse->
GetDEDw();
843 Int_t nWeights = nSynapses;
845 std::vector<Double_t> Origin(nWeights);
846 for (
Int_t i=0;i<nSynapses;i++) {
857 if (alpha2 < 0.01) alpha2 = 0.01;
858 else if (alpha2 > 2.0) alpha2 = 2.0;
870 for (
Int_t i=0;i<100;i++) {
889 for (
Int_t i=0;i<100;i++) {
892 Log() << kWARNING <<
"linesearch, starting to investigate direction opposite of steepestDIR" <<
Endl;
893 alpha2 = -alpha_original;
906 Log() << kWARNING <<
"linesearch, failed even in opposite direction of steepestDIR" <<
Endl;
912 if (alpha1>0 && alpha2>0 && alpha3 > 0) {
914 (err3 - err1) / ((err3 - err2) / ( alpha3 - alpha2 )
915 - ( err2 - err1 ) / (alpha2 - alpha1 )));
930 if (finalError > err1) {
931 Log() << kWARNING <<
"Line search increased error! Something is wrong."
932 <<
"fLastAlpha=" <<
fLastAlpha <<
"al123=" << alpha1 <<
" "
933 << alpha2 <<
" " << alpha3 <<
" err1="<< err1 <<
" errfinal=" << finalError <<
Endl;
936 for (
Int_t i=0;i<nSynapses;i++) {
938 buffer[IDX] = synapse->
GetWeight() - Origin[IDX];
942 if (dError) (*dError)=(errOrigin-finalError)/finalError;
954 for (
Int_t i=0;i<nSynapses;i++) {
956 synapse->
SetWeight( Origin[IDX] + Dir[IDX][0] * alpha );
971 for (
Int_t i=0;i<nEvents;i++) {
982 for (
UInt_t itgt = 0; itgt < ntgts; itgt++) {
986 for(
UInt_t icls = 0, iclsEnd =
DataInfo().GetNClasses(); icls < iclsEnd; icls++ ){
1011 error = 0.5*(output-target)*(output-target);
1054 if (
fSteps > 0)
Log() << kINFO <<
"Inaccurate progress timing for MLP... " <<
Endl;
1062 for (
Int_t i = 0; i < nEpochs; i++) {
1071 Data()->CreateSampling();
1076 Data()->CreateSampling();
1082 Data()->InitSampling(1.0,1.0);
1084 Data()->InitSampling(1.0,1.0);
1105 Data()->EventResult( success );
1115 if (lateEpoch > i) lateEpoch = i;
1147 for (
Int_t i = 0; i < nEvents; i++) index[i] = i;
1151 for (
Int_t i = 0; i < nEvents; i++) {
1193 for (
Int_t i = 0; i <
n; i++) {
1197 index[j] = index[i];
1211 for (
Int_t i = 0; i < numSynapses; i++) {
1235 if (type == 0) desired =
fOutput->GetMin();
1236 else desired =
fOutput->GetMax();
1290 else Log() << kFATAL <<
"Estimator type unspecified!!" <<
Endl;
1291 error *= eventWeight;
1305 for (
UInt_t i = 0, iEnd = desired.size(); i < iEnd; ++i) {
1311 for (
UInt_t i = 0, iEnd = desired.size(); i < iEnd; ++i) {
1314 Double_t error = output - desired.at(i);
1315 error *= eventWeight;
1336 for (
Int_t i = numLayers-1; i >= 0; i--) {
1340 for (
Int_t j = 0; j < numNeurons; j++) {
1367 std::vector<Interval*> ranges;
1370 for (
Int_t ivar=0; ivar< numWeights; ivar++) {
1378 Log() << kINFO <<
"GA: estimator after optimization: " << estimator <<
Endl;
1397 for (
Int_t i = 0; i < numSynapses; i++) {
1418 for (
Int_t i = 0; i < numLayers; i++) {
1422 for (
Int_t j = 0; j < numNeurons; j++) {
1440 for (
Int_t i = numLayers-1; i >= 0; i--) {
1444 for (
Int_t j = 0; j < numNeurons; j++) {
1458 for (
Int_t i=0;i<nSynapses;i++) {
1475 std::vector<Int_t> nWDP(numRegulators);
1476 std::vector<Double_t> trace(numRegulators),weightSum(numRegulators);
1477 for (
int i=0;i<numSynapses;i++) {
1481 trace[idx]+=InvH[i][i];
1491 for (
int i=0;i<numRegulators;i++)
1494 fRegulators[i]=variance*nWDP[i]/(weightSum[i]+variance*trace[i]);
1501 Log()<<kDEBUG<<
"\n"<<
"trainE:"<<trainE<<
"\ttestE:"<<testE<<
"\tvariance:"<<variance<<
"\tgamma:"<<gamma<<
Endl;
1510 InvHessian.
ResizeTo( numSynapses, numSynapses );
1515 for (
Int_t i=0;i<nEvents;i++) {
1520 for (
Int_t j = 0; j < numSynapses; j++){
1524 sens[j][0]=sensT[0][j]=synapses->
GetDelta();
1527 else if (
fEstimator==
kCE) InvHessian+=(outputValue*(1-outputValue))*sens*sensT;
1532 for (
Int_t i = 0; i < numSynapses; i++){
1537 for (
Int_t i = 0; i < numSynapses; i++){
1538 InvHessian[i][i]+=1
e-6;
1556 Double_t MvaUpper,MvaLower,median,variance;
1559 Log() << kWARNING <<
"inconsistent dimension " <<
fInvHessian.GetNcols() <<
" vs " << numSynapses <<
Endl;
1566 for (
Int_t i = 0; i < numSynapses; i++){
1578 Log()<<kWARNING<<
"Negative variance!!! median=" << median <<
"\tvariance(sigma^2)=" << variance <<
Endl;
1581 variance=sqrt(variance);
1584 MvaUpper=
fOutput->Eval(median+variance);
1586 *errUpper=MvaUpper-MvaValue;
1589 MvaLower=
fOutput->Eval(median-variance);
1591 *errLower=MvaValue-MvaLower;
1597#ifdef MethodMLP_UseMinuit__
1602void TMVA::MethodMLP::MinuitMinimize()
1604 fNumberOfWeights = fSynapses->GetEntriesFast();
1619 for (
Int_t ipar=0; ipar < fNumberOfWeights; ipar++) {
1622 parName, w[ipar], 0.1, 0, 0 );
1626 tfitter->
SetFCN( &IFCN );
1665 ((
MethodMLP*)GetThisPtr())->FCN( npars, grad,
f, fitPars, iflag );
1668TTHREAD_TLS(
Int_t) nc = 0;
1669TTHREAD_TLS(
double) minf = 1000000;
1674 for (
Int_t ipar=0; ipar<fNumberOfWeights; ipar++) {
1680 f = CalculateEstimator();
1683 if (
f < minf) minf =
f;
1684 for (
Int_t ipar=0; ipar<fNumberOfWeights; ipar++)
Log() <<
kDEBUG << fitPars[ipar] <<
" ";
1686 Log() <<
kDEBUG <<
"***** New estimator: " <<
f <<
" min: " << minf <<
" --> ncalls: " << nc <<
Endl;
1692TMVA::MethodMLP* TMVA::MethodMLP::GetThisPtr()
1720 Log() << col <<
"--- Short description:" << colres <<
Endl;
1722 Log() <<
"The MLP artificial neural network (ANN) is a traditional feed-" <<
Endl;
1723 Log() <<
"forward multilayer perceptron implementation. The MLP has a user-" <<
Endl;
1724 Log() <<
"defined hidden layer architecture, while the number of input (output)" <<
Endl;
1725 Log() <<
"nodes is determined by the input variables (output classes, i.e., " <<
Endl;
1726 Log() <<
"signal and one background). " <<
Endl;
1728 Log() << col <<
"--- Performance optimisation:" << colres <<
Endl;
1730 Log() <<
"Neural networks are stable and performing for a large variety of " <<
Endl;
1731 Log() <<
"linear and non-linear classification problems. However, in contrast" <<
Endl;
1732 Log() <<
"to (e.g.) boosted decision trees, the user is advised to reduce the " <<
Endl;
1733 Log() <<
"number of input variables that have only little discrimination power. " <<
Endl;
1735 Log() <<
"In the tests we have carried out so far, the MLP and ROOT networks" <<
Endl;
1736 Log() <<
"(TMlpANN, interfaced via TMVA) performed equally well, with however" <<
Endl;
1737 Log() <<
"a clear speed advantage for the MLP. The Clermont-Ferrand neural " <<
Endl;
1738 Log() <<
"net (CFMlpANN) exhibited worse classification performance in these" <<
Endl;
1739 Log() <<
"tests, which is partly due to the slow convergence of its training" <<
Endl;
1740 Log() <<
"(at least 10k training cycles are required to achieve approximately" <<
Endl;
1741 Log() <<
"competitive results)." <<
Endl;
1743 Log() << col <<
"Overtraining: " << colres
1744 <<
"only the TMlpANN performs an explicit separation of the" <<
Endl;
1745 Log() <<
"full training sample into independent training and validation samples." <<
Endl;
1746 Log() <<
"We have found that in most high-energy physics applications the " <<
Endl;
1747 Log() <<
"available degrees of freedom (training events) are sufficient to " <<
Endl;
1748 Log() <<
"constrain the weights of the relatively simple architectures required" <<
Endl;
1749 Log() <<
"to achieve good performance. Hence no overtraining should occur, and " <<
Endl;
1750 Log() <<
"the use of validation samples would only reduce the available training" <<
Endl;
1751 Log() <<
"information. However, if the performance on the training sample is " <<
Endl;
1752 Log() <<
"found to be significantly better than the one found with the inde-" <<
Endl;
1753 Log() <<
"pendent test sample, caution is needed. The results for these samples " <<
Endl;
1754 Log() <<
"are printed to standard output at the end of each training job." <<
Endl;
1756 Log() << col <<
"--- Performance tuning via configuration options:" << colres <<
Endl;
1758 Log() <<
"The hidden layer architecture for all ANNs is defined by the option" <<
Endl;
1759 Log() <<
"\"HiddenLayers=N+1,N,...\", where here the first hidden layer has N+1" <<
Endl;
1760 Log() <<
"neurons and the second N neurons (and so on), and where N is the number " <<
Endl;
1761 Log() <<
"of input variables. Excessive numbers of hidden layers should be avoided," <<
Endl;
1762 Log() <<
"in favour of more neurons in the first hidden layer." <<
Endl;
1764 Log() <<
"The number of cycles should be above 500. As said, if the number of" <<
Endl;
1765 Log() <<
"adjustable weights is small compared to the training sample size," <<
Endl;
1766 Log() <<
"using a large number of training samples should not lead to overtraining." <<
Endl;
#define REGISTER_METHOD(CLASS)
for example
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
TMatrixT< Double_t > TMatrixD
<div class="legacybox"><h2>Legacy Code</h2> TFitter is a legacy interface: there will be no bug fixes...
void SetFCN(void(*fcn)(Int_t &, Double_t *, Double_t &f, Double_t *, Int_t)) override
Specify the address of the fitting algorithm.
Int_t ExecuteCommand(const char *command, Double_t *args, Int_t nargs) override
Execute a fitter command; command : command string args : list of nargs command arguments.
Int_t SetParameter(Int_t ipar, const char *parname, Double_t value, Double_t verr, Double_t vlow, Double_t vhigh) override
set initial values for a parameter
1-D histogram with a float per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Bool_t WriteOptionsReference() const
OptionBase * DeclareOptionRef(T &ref, const TString &name, const TString &desc="")
void AddPreDefVal(const T &)
const TString & GetOptions() const
Bool_t HasConverged(Bool_t withinConvergenceBand=kFALSE)
gives back true if the last "steps" steps have lead to an improvement of the "fitness" of the "indivi...
void SetCurrentValue(Float_t value)
Float_t Progress()
returns a float from 0 (just started) to 1 (finished)
Float_t GetCurrentValue()
void ResetConvergenceCounter()
Float_t fImprovement
! minimum improvement which counts as improvement
Int_t fSteps
! number of steps without improvement required for convergence
Class that contains all the data information.
std::vector< Float_t > & GetTargets()
Double_t GetWeight() const
return the event weight - depending on whether the flag IgnoreNegWeightsInTraining is or not.
Float_t GetTarget(UInt_t itgt) const
Base class for TMVA fitters.
Double_t Run()
estimator function interface for fitting
Fitter using a Genetic Algorithm.
The TMVA::Interval Class.
std::vector< TH1 * > fEpochMonHistW
std::vector< TH1 * > fEpochMonHistB
void ProcessOptions() override
do nothing specific at this moment
TNeuron * GetInputNeuron(Int_t index)
void WaitForKeyboard()
wait for keyboard input, for debugging
MethodANNBase(const TString &jobName, Types::EMVA methodType, const TString &methodTitle, DataSetInfo &theData, const TString &theOption)
standard constructor Note: Right now it is an option to choose the neuron input function,...
TNeuron * GetOutputNeuron(Int_t index=0)
void MakeClassSpecific(std::ostream &, const TString &) const override
write specific classifier response
void PrintMessage(TString message, Bool_t force=kFALSE) const
print messages, turn off printing by setting verbose and debug flag appropriately
std::vector< Int_t > fRegulatorIdx
std::vector< Double_t > fRegulators
TH1F * fEstimatorHistTest
std::vector< TH1 * > fEpochMonHistS
Int_t fRandomSeed
random seed for initial synapse weights
TH1F * fEstimatorHistTrain
void ForceNetworkCalculations()
calculate input values to each neuron
Double_t GetMvaValue(Double_t *err=nullptr, Double_t *errUpper=nullptr) override
get the mva value generated by the NN
void ForceNetworkInputs(const Event *ev, Int_t ignoreIndex=-1)
force the input values of the input neurons force the value for each input neuron
virtual void PrintNetwork() const
print network representation, for debugging
void CreateWeightMonitoringHists(const TString &bulkname, std::vector< TH1 * > *hv=nullptr) const
const char * GetName() const override
Double_t GetXmin(Int_t ivar) const
Bool_t DoMulticlass() const
Types::EAnalysisType GetAnalysisType() const
Bool_t IgnoreEventsWithNegWeightsInTraining() const
UInt_t GetNTargets() const
virtual void SetAnalysisType(Types::EAnalysisType type)
UInt_t GetNEvents() const
Bool_t DoRegression() const
const Event * GetEvent() const
DataSetInfo & DataInfo() const
Double_t GetXmax(Int_t ivar) const
Bool_t IsSilentFile() const
void SetSignalReferenceCut(Double_t cut)
Bool_t IsNormalised() const
IPythonInteractive * fInteractive
Multilayer Perceptron class built off of MethodANNBase.
Int_t fResetStep
reset time (how often we clear hessian matrix)
bool fCalculateErrors
compute inverse hessian matrix at the end of the training
std::vector< std::pair< Float_t, Float_t > > * fDeviationsFromTargets
deviation from the targets, event weight
Double_t fTau
line search variable
Int_t fGA_SC_rate
GA settings: SC_rate.
void GetHelpMessage() const override
get help message text
Float_t fWeightRange
suppress outliers for the estimator calculation
Float_t fSamplingWeight
changing factor for event weights when sampling is turned on
Int_t fBatchSize
batch size, only matters if in batch learning mode
void BackPropagationMinimize(Int_t nEpochs)
minimize estimator / train network with back propagation algorithm
Double_t GetMSEErr(const Event *ev, UInt_t index=0)
zjh
void MakeClassSpecific(std::ostream &, const TString &) const override
write specific classifier response
void DeclareOptions() override
define the options (their key words) that can be set in the option string
void AdjustSynapseWeights()
just adjust the synapse weights (should be called in batch mode)
std::vector< Double_t > fPriorDev
zjh
TString fBpModeS
backprop learning mode option string (sequential or batch)
void SteepestDir(TMatrixD &Dir)
void TrainOneEpoch()
train network over a single epoch/cycle of events
TString fTrainMethodS
training method option param
Int_t fGA_nsteps
GA settings: number of steps.
Bool_t GetHessian(TMatrixD &Hessian, TMatrixD &Gamma, TMatrixD &Delta)
Double_t ComputeEstimator(std::vector< Double_t > ¶meters)
this function is called by GeneticANN for GA optimization
static const Bool_t fgPRINT_BATCH
debug flags
void InitializeLearningRates()
initialize learning rates of synapses, used only by back propagation
Int_t fGA_preCalc
GA settings: number of pre-calc steps.
void CalculateNeuronDeltas()
have each neuron calculate its delta by back propagation
Int_t fTestRate
test for overtraining performed at each th epochs
Double_t fDecayRate
decay rate for above learning rate
ETrainingMethod fTrainingMethod
method of training, BP or GA
Double_t EstimatorFunction(std::vector< Double_t > ¶meters) override
interface to the estimate
EBPTrainingMode fBPMode
backprop learning mode (sequential or batch)
Double_t DerivDir(TMatrixD &Dir)
Double_t fGA_SC_factor
GA settings: SC_factor.
Double_t GetCEErr(const Event *ev, UInt_t index=0)
zjh
virtual ~MethodMLP()
destructor nothing to be done
Int_t fGA_SC_steps
GA settings: SC_steps.
void SetDir(TMatrixD &Hessian, TMatrixD &Dir)
void Shuffle(Int_t *index, Int_t n)
Input:
Bool_t fSamplingTraining
The training sample is sampled.
void SimulateEvent(const Event *ev)
void SetDirWeights(std::vector< Double_t > &Origin, TMatrixD &Dir, Double_t alpha)
void SetGammaDelta(TMatrixD &Gamma, TMatrixD &Delta, std::vector< Double_t > &Buffer)
Double_t fLearnRate
learning rate for synapse weight adjustments
void GetApproxInvHessian(TMatrixD &InvHessian, bool regulate=true)
rank-1 approximation, neglect 2nd derivatives. //zjh
void BFGSMinimize(Int_t nEpochs)
train network with BFGS algorithm
void UpdateSynapses()
update synapse error fields and adjust the weights (if in sequential mode)
Float_t fSamplingFraction
fraction of events which is sampled for training
void TrainOneEvent(Int_t ievt)
train network over a single event this uses the new event model
Double_t GetDesiredOutput(const Event *ev)
get the desired output of this event
void GeneticMinimize()
create genetics class similar to GeneticCut give it vector of parameter ranges (parameters = weights)...
Bool_t fSamplingTesting
The testing sample is sampled.
Double_t fLastAlpha
line search variable
void Init() override
default initializations
Float_t fSamplingEpoch
fraction of epochs where sampling is used
Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets) override
MLP can handle classification with 2 classes and regression with one regression-target.
void DecaySynapseWeights(Bool_t lateEpoch)
decay synapse weights in last 10 epochs, lower learning rate even more to find a good minimum
void TrainOneEventFast(Int_t ievt, Float_t *&branchVar, Int_t &type)
fast per-event training
Bool_t fEpochMon
create and fill epoch-wise monitoring histograms (makes outputfile big!)
void UpdateNetwork(Double_t desired, Double_t eventWeight=1.0)
update the network based on how closely the output matched the desired output
MethodMLP(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption)
standard constructor
void UpdateRegulators()
zjh
Bool_t LineSearch(TMatrixD &Dir, std::vector< Double_t > &Buffer, Double_t *dError=nullptr)
zjh
Double_t GetMvaValue(Double_t *err=nullptr, Double_t *errUpper=nullptr) override
get the mva value generated by the NN
Double_t CalculateEstimator(Types::ETreeType treeType=Types::kTraining, Int_t iEpoch=-1)
calculate the estimator that training is attempting to minimize
void ProcessOptions() override
process user options
static const Bool_t fgPRINT_SEQ
debug flags
Neuron class used by TMVA artificial neural network methods.
void AdjustSynapseWeights()
adjust the pre-synapses' weights for each neuron (input neuron has no pre-synapse) this method should...
void ForceValue(Double_t value)
force the value, typically for input and bias neurons
void UpdateSynapsesSequential()
update the pre-synapses for each neuron (input neuron has no pre-synapse) this method should only be ...
void UpdateSynapsesBatch()
update and adjust the pre-synapses for each neuron (input neuron has no pre-synapse) this method shou...
void CalculateDelta()
calculate error field
Synapse class used by TMVA artificial neural network methods.
void SetWeight(Double_t weight)
set synapse weight
void SetDEDw(Double_t DEDw)
void SetLearningRate(Double_t rate)
void DecayLearningRate(Double_t rate)
void CalculateDelta()
calculate/adjust the error field for this synapse
Timing information for training and evaluation of MVA methods.
void DrawProgressBar(Int_t, const TString &comment="")
draws progress bar in color or B&W caution:
Singleton class for Global types used by TMVA.
virtual TMatrixTBase< Element > & UnitMatrix()
Make a unit matrix (matrix need not be a square one).
TMatrixT< Element > & Transpose(const TMatrixT< Element > &source)
Transpose matrix source.
TMatrixTBase< Element > & ResizeTo(Int_t nrows, Int_t ncols, Int_t=-1) override
Set size of the matrix to nrows x ncols New dynamic elements are created, the overlapping part of the...
TMatrixT< Element > & Invert(Double_t *det=nullptr)
Invert the matrix and calculate its determinant.
Int_t GetEntriesFast() const
TObject * At(Int_t idx) const override
const char * Data() const
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
void SetWeight(Double_t w)
Sets the weight of the synapse.
MsgLogger & Endl(MsgLogger &ml)
Double_t Exp(Double_t x)
Returns the base-e exponential function of x, which is e raised to the power x.
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Double_t Sqrt(Double_t x)
Returns the square root of x.