From 93281e20b4a7d63ed851a05ce38a17ab5295fdfa Mon Sep 17 00:00:00 2001 From: Michal Kravcenko <michal.kravcenko@vsb.cz> Date: Wed, 25 Jul 2018 15:26:23 +0200 Subject: [PATCH] Commit before merge --- src/ErrorFunction/ErrorFunctions.cpp | 10 +++++----- src/ErrorFunction/ErrorFunctions.h | 6 +++--- src/Solvers/DESolver.cpp | 2 +- src/net_test_3.cpp | 2 +- src/net_test_ode_1.cpp | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/ErrorFunction/ErrorFunctions.cpp b/src/ErrorFunction/ErrorFunctions.cpp index 1dc9d143..e7cac11d 100644 --- a/src/ErrorFunction/ErrorFunctions.cpp +++ b/src/ErrorFunction/ErrorFunctions.cpp @@ -51,13 +51,13 @@ double MSE::eval(double *weights) { return error/n_elements; } -ERROR_SUM::ERROR_SUM() { +ErrorSum::ErrorSum() { this->summand = nullptr; this->summand_coefficient = nullptr; this->dimension = 0; } -ERROR_SUM::~ERROR_SUM(){ +ErrorSum::~ErrorSum(){ if( this->summand ){ delete this->summand; } @@ -66,7 +66,7 @@ ERROR_SUM::~ERROR_SUM(){ } } -double ERROR_SUM::eval(double *weights) { +double ErrorSum::eval(double *weights) { double output = 0.0; for( unsigned int i = 0; i < this->summand->size(); ++i ){ @@ -76,7 +76,7 @@ double ERROR_SUM::eval(double *weights) { return output; } -void ERROR_SUM::add_error_function(ErrorFunction *F, double alpha) { +void ErrorSum::add_error_function(ErrorFunction *F, double alpha) { if(!this->summand){ this->summand = new std::vector<ErrorFunction*>(0); } @@ -92,7 +92,7 @@ void ERROR_SUM::add_error_function(ErrorFunction *F, double alpha) { } } -size_t ERROR_SUM::get_dimension() { +size_t ErrorSum::get_dimension() { // if(!this->dimension) { // size_t max = 0; // for(auto e : *this->summand) { diff --git a/src/ErrorFunction/ErrorFunctions.h b/src/ErrorFunction/ErrorFunctions.h index cae1d0ff..03ffbd33 100644 --- a/src/ErrorFunction/ErrorFunctions.h +++ b/src/ErrorFunction/ErrorFunctions.h @@ -59,17 +59,17 @@ private: DataSet* ds; }; -class ERROR_SUM : public ErrorFunction{ +class ErrorSum : public ErrorFunction{ public: /** * */ - ERROR_SUM(); + ErrorSum(); /** * */ - ~ERROR_SUM(); + ~ErrorSum(); /** * diff --git a/src/Solvers/DESolver.cpp b/src/Solvers/DESolver.cpp index 5c37a970..7ed3853c 100644 --- a/src/Solvers/DESolver.cpp +++ b/src/Solvers/DESolver.cpp @@ -345,7 +345,7 @@ void DESolver::solve_via_particle_swarm(double *domain_bounds, double c1, double } /* DEFINITION OF THE GLOBAL ERROR FUNCTION */ - ERROR_SUM total_error; + ErrorSum total_error; for(unsigned int i = 0; i < this->n_equations; ++i ) { total_error.add_error_function( error_functions[i], 1.0 ); } diff --git a/src/net_test_3.cpp b/src/net_test_3.cpp index 3f3f2cf6..5624a280 100644 --- a/src/net_test_3.cpp +++ b/src/net_test_3.cpp @@ -99,7 +99,7 @@ int main() { MSE mse_01(subnet_01, &ds_01); MSE mse_02(subnet_02, &ds_02); - ERROR_SUM mse_sum; + ErrorSum mse_sum; mse_sum.add_error_function( &mse_01 ); mse_sum.add_error_function( &mse_02 ); diff --git a/src/net_test_ode_1.cpp b/src/net_test_ode_1.cpp index 02be2df3..530f6fbb 100644 --- a/src/net_test_ode_1.cpp +++ b/src/net_test_ode_1.cpp @@ -18,7 +18,7 @@ int main() { unsigned int n_inputs = 1; - unsigned int n_inner_neurons = 64; + unsigned int n_inner_neurons = 4; unsigned int n_outputs = 1; unsigned int n_equations = 3; @@ -98,7 +98,7 @@ int main() { /* PARTICLE SWARM TRAINING METHOD SETUP */ - unsigned int max_iters = 1000; + unsigned int max_iters = 100; //must encapsulate each of the partial error functions double *domain_bounds = new double[ 2 * n_inner_neurons * (n_inputs + n_outputs) ]; -- GitLab