renamed DE::Engine::CalculateError to DE::Engine::TestFitness
added ErrorAccumulator to aid in calculating RMSE converted piecewiseapprox.cpp and polyapprox.cpp to use new pure virtual method name and ErrorAccumulator
This commit is contained in:
1 parent
6f03c0b106
commit
aac0b98ba9
4 files changed
+91
-34
No files matched your search
@@ -23,12 +23,35 @@ namespace DE
|
||||
void SetRange(unsigned int i, double minimum, double maximum);
|
||||
void SetRange(const Vector<DIM>& minimum, const Vector<DIM>& maximum);
|
||||
|
||||
virtual double CalculateError(const double testcase[DIM], bool& stop) = 0;
|
||||
virtual double TestFitness(const double testcase[DIM], bool& stop) = 0;
|
||||
|
||||
void Reset();
|
||||
bool Solve(unsigned int maxgenerations = 1000000000);
|
||||
bool RunOneGeneration();
|
||||
|
||||
public:
|
||||
|
||||
// helper class for accumulating error and calculating
|
||||
// root mean square error
|
||||
class ErrorAccumulator
|
||||
{
|
||||
public:
|
||||
ErrorAccumulator();
|
||||
virtual ~ErrorAccumulator();
|
||||
|
||||
void Clear();
|
||||
void AddTestCase(double expected, double actual);
|
||||
double GetRMSE();
|
||||
|
||||
private:
|
||||
|
||||
void CalculateError();
|
||||
|
||||
unsigned int num_tests; // # of test cases
|
||||
double sum_error_squared; // sum of error^2
|
||||
double error_rmse; // root mean square error (-1 == "dirty" flag)
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
// randomly select unique individuals
|
||||
|
||||
Reference in new issue
Block a user