HOG2
|
#include <LogisticRegression.h>
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 |
Definition at line 16 of file LogisticRegression.h.
LogisticRegression::LogisticRegression | ( | int | _inputs, |
int | _outputs, | ||
double | learnrate | ||
) |
Definition at line 22 of file LogisticRegression.cpp.
References allocateMemory(), inputs, kExponential, FunctionApproximator::outputActivation, outputs, FunctionApproximator::rate, updates, useBinary, and weight.
LogisticRegression::LogisticRegression | ( | LogisticRegression * | perp | ) |
Definition at line 35 of file LogisticRegression.cpp.
References load(), FunctionApproximator::outputActivation, outputs, FunctionApproximator::rate, updates, useBinary, and weight.
LogisticRegression::LogisticRegression | ( | char * | f | ) |
LogisticRegression::LogisticRegression | ( | FunctionApproximator * | fa | ) |
Definition at line 59 of file LogisticRegression.cpp.
References inputs, load(), FunctionApproximator::outputActivation, outputs, FunctionApproximator::rate, updates, useBinary, and weight.
LogisticRegression::~LogisticRegression | ( | ) |
Definition at line 74 of file LogisticRegression.cpp.
References freeMemory().
|
private |
Definition at line 137 of file LogisticRegression.cpp.
References inputs, output, outputs, updates, and weight.
Referenced by load(), and LogisticRegression().
|
private |
|
private |
|
private |
Definition at line 154 of file LogisticRegression.cpp.
References updates, and weight.
Referenced by load(), and ~LogisticRegression().
|
private |
Definition at line 327 of file LogisticRegression.cpp.
|
inlinevirtual |
Implements FunctionApproximator.
Definition at line 60 of file LogisticRegression.h.
|
inlinevirtual |
Reimplemented from FunctionApproximator.
Definition at line 46 of file LogisticRegression.h.
References weight.
|
inlinevirtual |
Reimplemented from FunctionApproximator.
Definition at line 44 of file LogisticRegression.h.
References inputs.
int LogisticRegression::getWeightFrequency | ( | unsigned int | weightNum, |
unsigned int | whichOutput = 0 |
||
) |
Definition at line 512 of file LogisticRegression.cpp.
References updates.
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.
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.
void LogisticRegression::getWeightUpdateSum | ( | std::vector< double > & | var, |
unsigned int | which = 0 |
||
) |
Definition at line 478 of file LogisticRegression.cpp.
double LogisticRegression::getWeightUpdateSum | ( | unsigned int | weightNum, |
unsigned int | whichOutput = 0 |
||
) |
Definition at line 488 of file LogisticRegression.cpp.
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.
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.
|
virtual |
Implements FunctionApproximator.
Definition at line 168 of file LogisticRegression.cpp.
Referenced by LogisticRegression().
|
inlinevirtual |
Implements FunctionApproximator.
Definition at line 33 of file LogisticRegression.h.
References load().
Referenced by load().
void LogisticRegression::load | ( | const LogisticRegression * | p | ) |
Definition at line 241 of file LogisticRegression.cpp.
References allocateMemory(), freeMemory(), inputs, FunctionApproximator::outputActivation, outputs, and weight.
|
virtual |
Implements FunctionApproximator.
Definition at line 188 of file LogisticRegression.cpp.
References allocateMemory(), freeMemory(), inputs, little2machine(), MINVERSION, outputs, useBinary, VERSION, and weight.
|
private |
|
virtual |
Implements FunctionApproximator.
Definition at line 523 of file LogisticRegression.cpp.
void LogisticRegression::resetWeightVariance | ( | ) |
Definition at line 501 of file LogisticRegression.cpp.
References updates.
void LogisticRegression::resetWeightVariance | ( | unsigned int | weightNum, |
unsigned int | whichOutput = 0 |
||
) |
Definition at line 496 of file LogisticRegression.cpp.
References updates.
void LogisticRegression::resizeInputs | ( | int | newSize | ) |
void LogisticRegression::resizeInputs | ( | int | newSize, |
double | newVal | ||
) |
|
virtual |
Implements FunctionApproximator.
Definition at line 288 of file LogisticRegression.cpp.
|
virtual |
Implements FunctionApproximator.
Definition at line 301 of file LogisticRegression.cpp.
References inputs, little2machine(), outputs, useBinary, VERSION, and weight.
void LogisticRegression::setInputWeight | ( | double | value, |
unsigned int | weightNum, | ||
unsigned int | whichOutput = 0 |
||
) |
Definition at line 517 of file LogisticRegression.cpp.
|
inline |
Definition at line 24 of file LogisticRegression.h.
References useBinary.
|
virtual |
Implements FunctionApproximator.
Definition at line 414 of file LogisticRegression.cpp.
References g(), inputs, output, outputs, and weight.
Referenced by train().
|
virtual |
Implements FunctionApproximator.
Definition at line 400 of file LogisticRegression.cpp.
|
virtual |
Implements FunctionApproximator.
Definition at line 374 of file LogisticRegression.cpp.
References inputs, updateData::mean, updateData::n, output, outputerr(), outputs, FunctionApproximator::rate, updateData::S, test(), updateData::totErr, updates, and weight.
|
virtual |
Implements FunctionApproximator.
Definition at line 349 of file LogisticRegression.cpp.
References inputs, updateData::mean, updateData::n, output, outputerr(), outputs, FunctionApproximator::rate, updateData::S, test(), updateData::totErr, updates, and weight.
|
static |
Definition at line 265 of file LogisticRegression.cpp.
References VERSION.
|
private |
Definition at line 77 of file LogisticRegression.h.
Referenced by allocateMemory(), getNumInputs(), load(), LogisticRegression(), Print(), resizeInputs(), save(), test(), and train().
|
private |
Definition at line 74 of file LogisticRegression.h.
Referenced by allocateMemory(), test(), and train().
|
private |
Definition at line 77 of file LogisticRegression.h.
Referenced by allocateMemory(), load(), LogisticRegression(), Print(), resizeInputs(), save(), test(), and train().
|
private |
Definition at line 72 of file LogisticRegression.h.
Referenced by allocateMemory(), freeMemory(), getWeightFrequency(), getWeightUpdateAverage(), getWeightUpdateSum(), getWeightUpdateVariance(), LogisticRegression(), resetWeightVariance(), resizeInputs(), setInputWeight(), and train().
|
private |
Definition at line 78 of file LogisticRegression.h.
Referenced by load(), LogisticRegression(), save(), and setUseBinary().
|
private |
Definition at line 71 of file LogisticRegression.h.
Referenced by allocateMemory(), freeMemory(), getInputWeight(), getWeightUpdateAverage(), getWeightUpdateSum(), getWeightUpdateVariance(), load(), LogisticRegression(), Print(), resizeInputs(), save(), setInputWeight(), test(), and train().