HOG2
|
#include <LinearRegression.h>
Public Member Functions | |
LinearRegression (int _inputs, int _outputs, double learnrate) | |
LinearRegression (LinearRegression *) | |
LinearRegression (char *) | |
LinearRegression (FunctionApproximator *) | |
~LinearRegression () | |
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 LinearRegression *) |
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 27 of file LinearRegression.h.
LinearRegression::LinearRegression | ( | int | _inputs, |
int | _outputs, | ||
double | learnrate | ||
) |
Definition at line 23 of file LinearRegression.cpp.
References allocateMemory(), inputs, kLinear, FunctionApproximator::outputActivation, outputs, FunctionApproximator::rate, updates, useBinary, and weight.
LinearRegression::LinearRegression | ( | LinearRegression * | perp | ) |
Definition at line 36 of file LinearRegression.cpp.
References load(), FunctionApproximator::outputActivation, outputs, FunctionApproximator::rate, updates, useBinary, and weight.
LinearRegression::LinearRegression | ( | char * | f | ) |
LinearRegression::LinearRegression | ( | FunctionApproximator * | fa | ) |
Definition at line 60 of file LinearRegression.cpp.
References inputs, load(), FunctionApproximator::outputActivation, outputs, FunctionApproximator::rate, updates, useBinary, and weight.
LinearRegression::~LinearRegression | ( | ) |
Definition at line 75 of file LinearRegression.cpp.
References freeMemory().
|
private |
Definition at line 138 of file LinearRegression.cpp.
References inputs, output, outputs, updates, and weight.
Referenced by LinearRegression(), and load().
|
private |
|
private |
|
private |
Definition at line 154 of file LinearRegression.cpp.
References updates, and weight.
Referenced by load(), and ~LinearRegression().
|
private |
|
inlinevirtual |
Implements FunctionApproximator.
Definition at line 71 of file LinearRegression.h.
|
inlinevirtual |
Reimplemented from FunctionApproximator.
Definition at line 57 of file LinearRegression.h.
References weight.
|
inlinevirtual |
Reimplemented from FunctionApproximator.
Definition at line 55 of file LinearRegression.h.
References inputs.
int LinearRegression::getWeightFrequency | ( | unsigned int | weightNum, |
unsigned int | whichOutput = 0 |
||
) |
Definition at line 496 of file LinearRegression.cpp.
References updates.
void LinearRegression::getWeightUpdateAverage | ( | std::vector< double > & | var, |
unsigned int | which = 0 |
||
) |
Definition at line 437 of file LinearRegression.cpp.
References updateData::n, updateData::totErr, updates, and weight.
double LinearRegression::getWeightUpdateAverage | ( | unsigned int | weightNum, |
unsigned int | whichOutput = 0 |
||
) |
Definition at line 451 of file LinearRegression.cpp.
References updateData::n, updateData::totErr, updates, and weight.
void LinearRegression::getWeightUpdateSum | ( | std::vector< double > & | var, |
unsigned int | which = 0 |
||
) |
Definition at line 462 of file LinearRegression.cpp.
double LinearRegression::getWeightUpdateSum | ( | unsigned int | weightNum, |
unsigned int | whichOutput = 0 |
||
) |
Definition at line 472 of file LinearRegression.cpp.
void LinearRegression::getWeightUpdateVariance | ( | std::vector< double > & | var, |
unsigned int | which = 0 |
||
) |
Definition at line 412 of file LinearRegression.cpp.
References updateData::n, updateData::S, updates, and weight.
double LinearRegression::getWeightUpdateVariance | ( | unsigned int | weightNum, |
unsigned int | whichOutput = 0 |
||
) |
Definition at line 426 of file LinearRegression.cpp.
References updateData::n, updateData::S, updates, and weight.
|
virtual |
Implements FunctionApproximator.
Definition at line 168 of file LinearRegression.cpp.
Referenced by LinearRegression().
|
inlinevirtual |
Implements FunctionApproximator.
Definition at line 44 of file LinearRegression.h.
References load().
Referenced by load().
void LinearRegression::load | ( | const LinearRegression * | p | ) |
Definition at line 241 of file LinearRegression.cpp.
References allocateMemory(), freeMemory(), inputs, FunctionApproximator::outputActivation, outputs, and weight.
|
virtual |
Implements FunctionApproximator.
Definition at line 188 of file LinearRegression.cpp.
References allocateMemory(), freeMemory(), inputs, little2machine(), MINVERSION, outputs, useBinary, VERSION, and weight.
|
private |
Definition at line 328 of file LinearRegression.cpp.
Referenced by train().
|
virtual |
Implements FunctionApproximator.
Definition at line 507 of file LinearRegression.cpp.
void LinearRegression::resetWeightVariance | ( | ) |
Definition at line 485 of file LinearRegression.cpp.
References updates.
void LinearRegression::resetWeightVariance | ( | unsigned int | weightNum, |
unsigned int | whichOutput = 0 |
||
) |
Definition at line 480 of file LinearRegression.cpp.
References updates.
void LinearRegression::resizeInputs | ( | int | newSize | ) |
void LinearRegression::resizeInputs | ( | int | newSize, |
double | newVal | ||
) |
|
virtual |
Implements FunctionApproximator.
Definition at line 288 of file LinearRegression.cpp.
|
virtual |
Implements FunctionApproximator.
Definition at line 301 of file LinearRegression.cpp.
References inputs, little2machine(), outputs, useBinary, VERSION, and weight.
void LinearRegression::setInputWeight | ( | double | value, |
unsigned int | weightNum, | ||
unsigned int | whichOutput = 0 |
||
) |
Definition at line 501 of file LinearRegression.cpp.
|
inline |
Definition at line 35 of file LinearRegression.h.
References useBinary.
|
virtual |
Implements FunctionApproximator.
Definition at line 399 of file LinearRegression.cpp.
References inputs, output, outputs, and weight.
Referenced by train().
|
virtual |
Implements FunctionApproximator.
Definition at line 386 of file LinearRegression.cpp.
|
virtual |
Implements FunctionApproximator.
Definition at line 360 of file LinearRegression.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 335 of file LinearRegression.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 LinearRegression.cpp.
References VERSION.
|
private |
Definition at line 89 of file LinearRegression.h.
Referenced by allocateMemory(), getNumInputs(), LinearRegression(), load(), Print(), resizeInputs(), save(), test(), and train().
|
private |
Definition at line 86 of file LinearRegression.h.
Referenced by allocateMemory(), test(), and train().
|
private |
Definition at line 89 of file LinearRegression.h.
Referenced by allocateMemory(), LinearRegression(), load(), Print(), resizeInputs(), save(), test(), and train().
|
private |
Definition at line 84 of file LinearRegression.h.
Referenced by allocateMemory(), freeMemory(), getWeightFrequency(), getWeightUpdateAverage(), getWeightUpdateSum(), getWeightUpdateVariance(), LinearRegression(), resetWeightVariance(), resizeInputs(), setInputWeight(), and train().
|
private |
Definition at line 90 of file LinearRegression.h.
Referenced by LinearRegression(), load(), save(), and setUseBinary().
|
private |
Definition at line 83 of file LinearRegression.h.
Referenced by allocateMemory(), freeMemory(), getInputWeight(), getWeightUpdateAverage(), getWeightUpdateSum(), getWeightUpdateVariance(), LinearRegression(), load(), Print(), resizeInputs(), save(), setInputWeight(), test(), and train().