HOG2
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
LogisticRegression Class Reference

#include <LogisticRegression.h>

Inheritance diagram for LogisticRegression:
Inheritance graph
[legend]
Collaboration diagram for LogisticRegression:
Collaboration graph
[legend]

Public Member Functions

 LogisticRegression (int _inputs, int _outputs, double learnrate)
 
 LogisticRegression (LogisticRegression *)
 
 LogisticRegression (char *)
 
 LogisticRegression (FunctionApproximator *)
 
 ~LogisticRegression ()
 
void setUseBinary (bool binary)
 
void resizeInputs (int newSize, double newVal)
 
void resizeInputs (int newSize)
 
void save (const char *)
 
void save (FILE *)
 
void load (const char *)
 
void load (FILE *)
 
void load (const FunctionApproximator *fa)
 
void load (const LogisticRegression *)
 
double train (std::vector< double > &input, std::vector< double > &output2)
 
double * test (const std::vector< double > &input)
 
double train (std::vector< unsigned int > &input, std::vector< double > &output2)
 
double * test (const std::vector< unsigned int > &input)
 
void Print ()
 
int getNumInputs ()
 
void setInputWeight (double value, unsigned int weightNum, unsigned int whichOutput=0)
 
double getInputWeight (int inp, int outp=0)
 
void getWeightUpdateVariance (std::vector< double > &var, unsigned int which=0)
 
double getWeightUpdateVariance (unsigned int weightNum, unsigned int whichOutput=0)
 
void getWeightUpdateAverage (std::vector< double > &var, unsigned int which=0)
 
double getWeightUpdateAverage (unsigned int weightNum, unsigned int whichOutput=0)
 
void getWeightUpdateSum (std::vector< double > &var, unsigned int which=0)
 
double getWeightUpdateSum (unsigned int weightNum, unsigned int whichOutput=0)
 
void resetWeightVariance (unsigned int weightNum, unsigned int whichOutput=0)
 
void resetWeightVariance ()
 
int getWeightFrequency (unsigned int weightNum, unsigned int whichOutput=0)
 
double GetInput (std::vector< double > &input, const std::vector< double > &target)
 
- Public Member Functions inherited from FunctionApproximator
 FunctionApproximator ()
 
virtual ~FunctionApproximator ()
 
virtual void setLearnRate (double)
 
virtual double getLearnRate ()
 
void setOutputActivation (tActivation t)
 
tActivation getOutputActivation ()
 

Static Public Member Functions

static bool validSaveFile (char *fname)
 

Private Member Functions

void allocateMemory ()
 
void freeMemory ()
 
double g (double a)
 
double dg (double a)
 
double outputerr (std::vector< double > &output, std::vector< double > &expected, int which)
 
double error (double *output)
 

Private Attributes

std::vector< std::vector< double > > weight
 
std::vector< std::vector< updateData > > updates
 
std::vector< double > output
 
int inputs
 
int outputs
 
bool useBinary
 

Additional Inherited Members

- Protected Attributes inherited from FunctionApproximator
double rate
 
tActivation outputActivation
 

Detailed Description

Definition at line 16 of file LogisticRegression.h.

Constructor & Destructor Documentation

◆ LogisticRegression() [1/4]

LogisticRegression::LogisticRegression ( int  _inputs,
int  _outputs,
double  learnrate 
)

◆ LogisticRegression() [2/4]

LogisticRegression::LogisticRegression ( LogisticRegression perp)

◆ LogisticRegression() [3/4]

LogisticRegression::LogisticRegression ( char *  f)

Definition at line 49 of file LogisticRegression.cpp.

References inputs, load(), outputs, updates, useBinary, and weight.

◆ LogisticRegression() [4/4]

LogisticRegression::LogisticRegression ( FunctionApproximator fa)

◆ ~LogisticRegression()

LogisticRegression::~LogisticRegression ( )

Definition at line 74 of file LogisticRegression.cpp.

References freeMemory().

Member Function Documentation

◆ allocateMemory()

void LogisticRegression::allocateMemory ( )
private

Definition at line 137 of file LogisticRegression.cpp.

References inputs, output, outputs, updates, and weight.

Referenced by load(), and LogisticRegression().

◆ dg()

double LogisticRegression::dg ( double  a)
private

Definition at line 332 of file LogisticRegression.cpp.

References g().

Referenced by outputerr().

◆ error()

double LogisticRegression::error ( double *  output)
private

◆ freeMemory()

void LogisticRegression::freeMemory ( )
private

Definition at line 154 of file LogisticRegression.cpp.

References updates, and weight.

Referenced by load(), and ~LogisticRegression().

◆ g()

double LogisticRegression::g ( double  a)
private

Definition at line 327 of file LogisticRegression.cpp.

Referenced by dg(), and test().

◆ GetInput()

double LogisticRegression::GetInput ( std::vector< double > &  input,
const std::vector< double > &  target 
)
inlinevirtual

Implements FunctionApproximator.

Definition at line 60 of file LogisticRegression.h.

◆ getInputWeight()

double LogisticRegression::getInputWeight ( int  inp,
int  outp = 0 
)
inlinevirtual

Reimplemented from FunctionApproximator.

Definition at line 46 of file LogisticRegression.h.

References weight.

◆ getNumInputs()

int LogisticRegression::getNumInputs ( )
inlinevirtual

Reimplemented from FunctionApproximator.

Definition at line 44 of file LogisticRegression.h.

References inputs.

◆ getWeightFrequency()

int LogisticRegression::getWeightFrequency ( unsigned int  weightNum,
unsigned int  whichOutput = 0 
)

Definition at line 512 of file LogisticRegression.cpp.

References updates.

◆ getWeightUpdateAverage() [1/2]

void LogisticRegression::getWeightUpdateAverage ( std::vector< double > &  var,
unsigned int  which = 0 
)

Definition at line 453 of file LogisticRegression.cpp.

References updateData::n, updateData::totErr, updates, and weight.

◆ getWeightUpdateAverage() [2/2]

double LogisticRegression::getWeightUpdateAverage ( unsigned int  weightNum,
unsigned int  whichOutput = 0 
)

Definition at line 467 of file LogisticRegression.cpp.

References updateData::n, updateData::totErr, updates, and weight.

◆ getWeightUpdateSum() [1/2]

void LogisticRegression::getWeightUpdateSum ( std::vector< double > &  var,
unsigned int  which = 0 
)

Definition at line 478 of file LogisticRegression.cpp.

References updates, and weight.

◆ getWeightUpdateSum() [2/2]

double LogisticRegression::getWeightUpdateSum ( unsigned int  weightNum,
unsigned int  whichOutput = 0 
)

Definition at line 488 of file LogisticRegression.cpp.

References updates, and weight.

◆ getWeightUpdateVariance() [1/2]

void LogisticRegression::getWeightUpdateVariance ( std::vector< double > &  var,
unsigned int  which = 0 
)

Definition at line 428 of file LogisticRegression.cpp.

References updateData::n, updateData::S, updates, and weight.

◆ getWeightUpdateVariance() [2/2]

double LogisticRegression::getWeightUpdateVariance ( unsigned int  weightNum,
unsigned int  whichOutput = 0 
)

Definition at line 442 of file LogisticRegression.cpp.

References updateData::n, updateData::S, updates, and weight.

◆ load() [1/4]

void LogisticRegression::load ( const char *  fname)
virtual

Implements FunctionApproximator.

Definition at line 168 of file LogisticRegression.cpp.

Referenced by LogisticRegression().

◆ load() [2/4]

void LogisticRegression::load ( const FunctionApproximator fa)
inlinevirtual

Implements FunctionApproximator.

Definition at line 33 of file LogisticRegression.h.

References load().

Referenced by load().

◆ load() [3/4]

void LogisticRegression::load ( const LogisticRegression p)

◆ load() [4/4]

void LogisticRegression::load ( FILE *  f)
virtual

◆ outputerr()

double LogisticRegression::outputerr ( std::vector< double > &  output,
std::vector< double > &  expected,
int  which 
)
private

Definition at line 338 of file LogisticRegression.cpp.

References dg().

Referenced by train().

◆ Print()

void LogisticRegression::Print ( )
virtual

Implements FunctionApproximator.

Definition at line 523 of file LogisticRegression.cpp.

References inputs, outputs, and weight.

◆ resetWeightVariance() [1/2]

void LogisticRegression::resetWeightVariance ( )

Definition at line 501 of file LogisticRegression.cpp.

References updates.

◆ resetWeightVariance() [2/2]

void LogisticRegression::resetWeightVariance ( unsigned int  weightNum,
unsigned int  whichOutput = 0 
)

Definition at line 496 of file LogisticRegression.cpp.

References updates.

◆ resizeInputs() [1/2]

void LogisticRegression::resizeInputs ( int  newSize)

Definition at line 108 of file LogisticRegression.cpp.

References inputs, outputs, updates, and weight.

◆ resizeInputs() [2/2]

void LogisticRegression::resizeInputs ( int  newSize,
double  newVal 
)

Definition at line 79 of file LogisticRegression.cpp.

References inputs, outputs, updates, and weight.

◆ save() [1/2]

void LogisticRegression::save ( const char *  fname)
virtual

Implements FunctionApproximator.

Definition at line 288 of file LogisticRegression.cpp.

◆ save() [2/2]

void LogisticRegression::save ( FILE *  f)
virtual

Implements FunctionApproximator.

Definition at line 301 of file LogisticRegression.cpp.

References inputs, little2machine(), outputs, useBinary, VERSION, and weight.

◆ setInputWeight()

void LogisticRegression::setInputWeight ( double  value,
unsigned int  weightNum,
unsigned int  whichOutput = 0 
)

Definition at line 517 of file LogisticRegression.cpp.

References updates, and weight.

◆ setUseBinary()

void LogisticRegression::setUseBinary ( bool  binary)
inline

Definition at line 24 of file LogisticRegression.h.

References useBinary.

◆ test() [1/2]

double * LogisticRegression::test ( const std::vector< double > &  input)
virtual

Implements FunctionApproximator.

Definition at line 414 of file LogisticRegression.cpp.

References g(), inputs, output, outputs, and weight.

Referenced by train().

◆ test() [2/2]

double * LogisticRegression::test ( const std::vector< unsigned int > &  input)
virtual

Implements FunctionApproximator.

Definition at line 400 of file LogisticRegression.cpp.

References g(), inputs, output, outputs, and weight.

◆ train() [1/2]

double LogisticRegression::train ( std::vector< double > &  input,
std::vector< double > &  output2 
)
virtual

◆ train() [2/2]

double LogisticRegression::train ( std::vector< unsigned int > &  input,
std::vector< double > &  output2 
)
virtual

◆ validSaveFile()

bool LogisticRegression::validSaveFile ( char *  fname)
static

Definition at line 265 of file LogisticRegression.cpp.

References VERSION.

Member Data Documentation

◆ inputs

int LogisticRegression::inputs
private

◆ output

std::vector<double> LogisticRegression::output
private

Definition at line 74 of file LogisticRegression.h.

Referenced by allocateMemory(), test(), and train().

◆ outputs

int LogisticRegression::outputs
private

◆ updates

std::vector<std::vector<updateData> > LogisticRegression::updates
private

◆ useBinary

bool LogisticRegression::useBinary
private

Definition at line 78 of file LogisticRegression.h.

Referenced by load(), LogisticRegression(), save(), and setUseBinary().

◆ weight

std::vector<std::vector<double> > LogisticRegression::weight
private

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