CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

PhysicsTools::MLP Class Reference

#include <MLP.h>

List of all members.

Public Member Functions

void clear ()
const double * eval (double *data) const
unsigned int getEpoch () const
int getLayers () const
const int * getLayout () const
void init (unsigned int rows)
void load (const std::string file)
 MLP (unsigned int nIn, unsigned int nOut, const std::string layout)
void save (const std::string file) const
void set (unsigned int row, double *data, double *target, double weight=1.0)
double train ()
 ~MLP ()

Private Member Functions

void setLearn (void)
void setNPattern (unsigned int size)

Private Attributes

unsigned int epoch
bool initialized
int layers
int * layout

Static Private Attributes

static bool inUse = false

Detailed Description

Definition at line 6 of file MLP.h.


Constructor & Destructor Documentation

PhysicsTools::MLP::MLP ( unsigned int  nIn,
unsigned int  nOut,
const std::string  layout 
)

Definition at line 45 of file MLP.cc.

References Exception, i, InitWeights(), makeLayoutFileForGui::layout, LearnAlloc(), MLP_SetNet(), and PhysicsTools::split().

{
        if (inUse)
                throw cms::Exception("MLP")
                        << "mlpfit doesn't support more than one instance."
                        << std::endl;

        std::vector<std::string> parsed = split(layout_, ':');
        if (parsed.size() < 1)
                throw cms::Exception("MLP")
                        << "Invalid layout." << std::endl;

        layout = new int[parsed.size() + 2];

        layers = parsed.size();
        layout[0] = (int)nIn;
        for(int i = 0; i < layers; i++) {
                std::istringstream ss(parsed[i]);
                int nodes;
                ss >> nodes;
                if (nodes < 1)
                        throw cms::Exception("MLP")
                                << "Invalid layout." << std::endl;

                layout[i + 1] = nodes;
        }
        layout[layers + 1] = (int)nOut;
        layers += 2;

        inUse = true;

        MLP_SetNet(&layers, layout);
        setLearn();
        LearnAlloc();
        InitWeights();
}

MLP::~MLP()
PhysicsTools::MLP::~MLP ( )

Definition at line 83 of file MLP.cc.

{

Member Function Documentation

void PhysicsTools::MLP::clear ( void  )

Definition at line 92 of file MLP.cc.

{
const double * PhysicsTools::MLP::eval ( double *  data) const

Definition at line 149 of file MLP.cc.

{
unsigned int PhysicsTools::MLP::getEpoch ( ) const [inline]

Definition at line 19 of file MLP.h.

References epoch.

{ return epoch; }
int PhysicsTools::MLP::getLayers ( ) const [inline]

Definition at line 20 of file MLP.h.

References layers.

{ return layers; }
const int* PhysicsTools::MLP::getLayout ( ) const [inline]

Definition at line 21 of file MLP.h.

References layout.

{ return layout; }
void PhysicsTools::MLP::init ( unsigned int  rows)

Definition at line 124 of file MLP.cc.

{
void PhysicsTools::MLP::load ( const std::string  file)

Definition at line 163 of file MLP.cc.

void PhysicsTools::MLP::save ( const std::string  file) const

Definition at line 156 of file MLP.cc.

{
void PhysicsTools::MLP::set ( unsigned int  row,
double *  data,
double *  target,
double  weight = 1.0 
)

Definition at line 131 of file MLP.cc.

{
void PhysicsTools::MLP::setLearn ( void  ) [private]

Definition at line 104 of file MLP.cc.

{
void PhysicsTools::MLP::setNPattern ( unsigned int  size) [private]

Definition at line 116 of file MLP.cc.

{
double PhysicsTools::MLP::train ( )

Definition at line 141 of file MLP.cc.

{

Member Data Documentation

unsigned int PhysicsTools::MLP::epoch [private]

Definition at line 31 of file MLP.h.

Referenced by getEpoch().

Definition at line 27 of file MLP.h.

data refman pasoursint CMSSW_5_2_7_hltpatch2 src PhysicsTools MVATrainer plugins MLP cc data refman pasoursint CMSSW_5_2_7_hltpatch2 src PhysicsTools MVATrainer plugins MLP cc bool PhysicsTools::MLP::inUse = false [static, private]

Definition at line 32 of file MLP.h.

Definition at line 28 of file MLP.h.

Referenced by getLayers().

int* PhysicsTools::MLP::layout [private]

Definition at line 29 of file MLP.h.

Referenced by getLayout().