Commit d1ddd66e authored by Michal Kravcenko's avatar Michal Kravcenko

-corrected example and complex error function definitions

parent bbdcff15
......@@ -31,6 +31,9 @@ target_link_libraries(neuron_serialization_example 4neuro)
add_executable(net_test_1 net_test_1.cpp)
target_link_libraries(net_test_1 4neuro)
add_executable(net_test_2 net_test_2.cpp)
target_link_libraries(net_test_2 4neuro)
##############
# UNIT TESTS #
##############
......
......@@ -55,7 +55,7 @@ private:
DataSet* ds;
};
class MSE_SUM : ErrorFunction{
class MSE_SUM : public ErrorFunction{
public:
/**
*
......
......@@ -52,9 +52,8 @@ int main() {
int idx1 = net.add_neuron(i1);
int idx2 = net.add_neuron(i2);
int idx3 = net.add_neuron(o1);
int idx4 = net2.add_neuron(i3);
int idx5 = net2.add_neuron(i4);
int idx4 = net.add_neuron(i3);
int idx5 = net.add_neuron(o2);
/* Adding connections */
//net.add_connection_simple(idx1, idx3, -1, 1.0);
......@@ -86,17 +85,17 @@ int main() {
subnet_01_input_neurons.push_back(idx1);
subnet_01_input_neurons.push_back(idx2);
subnet_01_output_neurons.push_back(idx3);
NeuralNetwork subnet_01(net, subnet_01_input_neurons, subnet_01_output_neurons);
NeuralNetwork *subnet_01 = net.get_subnet(subnet_01_input_neurons, subnet_01_output_neurons);
subnet_02_input_neurons.push_back(idx4);
subnet_02_output_neurons.push_back(idx5);
NeuralNetwork subnet_02(net, subnet_02_input_neurons, subnet_02_output_neurons);
NeuralNetwork *subnet_02 = net.get_subnet(subnet_02_input_neurons, subnet_02_output_neurons);
/* COMPLEX ERROR FUNCTION SPECIFICATION */
MSE mse_01(subnet_01, &ds_01);
MSE mse_02(subnet_02, &ds_02);
/* ERROR FUNCTION SPECIFICATION */
MSE mse_01(&subnet_01, &ds_01);
MSE mse_02(&subnet_02, &ds_02);
MSE_SUM mse_sum( );
MSE_SUM mse_sum;
mse_sum.add_error_function( &mse_01 );
mse_sum.add_error_function( &mse_02 );
......@@ -116,5 +115,8 @@ int main() {
swarm_01.optimize(0.5, 0.02);
delete subnet_02;
delete subnet_01;
return 0;
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment