Skip to content

Commit

Permalink
Examples cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
davidge807 committed Jan 4, 2023
1 parent 5e24ce2 commit a195cc3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 36 deletions.
1 change: 0 additions & 1 deletion examples/iris_plant/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ int main()
TrainingStrategy training_strategy(&neural_network, &data_set);

training_strategy.set_loss_method(TrainingStrategy::LossMethod::MEAN_SQUARED_ERROR);
// training_strategy.set_optimization_method(TrainingStrategy::OptimizationMethod::ADAPTIVE_MOMENT_ESTIMATION);
training_strategy.set_optimization_method(TrainingStrategy::OptimizationMethod::QUASI_NEWTON_METHOD);
training_strategy.perform_training();

Expand Down
37 changes: 2 additions & 35 deletions examples/mnist/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ int main()
const Index input_variables_number = data_set.get_input_variables_number();
const Index target_variables_number = data_set.get_target_variables_number();


// data_set.set_training();



const Tensor<Index, 1> samples_indices = data_set.get_training_samples_indices();

const Tensor<Index, 1> input_variables_indices = data_set.get_input_variables_indices();
Expand All @@ -79,42 +74,15 @@ int main()

NeuralNetwork neural_network;


ScalingLayer scaling_layer(input_variables_dimensions);
neural_network.add_layer(&scaling_layer);

FlattenLayer flatten_layer(input_variables_dimensions);
neural_network.add_layer(&flatten_layer);

cout << "Flatten layer height: " << flatten_layer.get_input_height() << endl;
cout << "Flatten layer width: " << flatten_layer.get_input_width() << endl;
cout << "Flatten layer channels number: " << flatten_layer.get_inputs_channels_number() << endl;

ProbabilisticLayer probabilistic_layer(input_variables_number, target_variables_number);
neural_network.add_layer(&probabilistic_layer);

/*
// Neural network
NeuralNetwork neural_network;
ScalingLayer scaling_layer(input_variables_dimensions);
neural_network.add_layer(&scaling_layer);
FlattenLayer flatten_layer(input_variables_dimensions);
neural_network.add_layer(&flatten_layer);
const Index hidden_layers_number = 512;
const Index flatten_layer_outputs = flatten_layer.get_neurons_number();
PerceptronLayer perceptron_layer(flatten_layer_outputs, hidden_layers_number);
neural_network.add_layer(&perceptron_layer);
ProbabilisticLayer probabilistic_layer(hidden_layers_number, target_variables_number);
neural_network.add_layer(&probabilistic_layer);
*/

// Training strategy

TrainingStrategy training_strategy(&neural_network, &data_set);
Expand All @@ -126,7 +94,6 @@ int main()
training_strategy.get_adaptive_moment_estimation_pointer()->set_maximum_epochs_number(10000);

training_strategy.perform_training();
/*

// Testing analysis

Expand Down Expand Up @@ -154,14 +121,14 @@ int main()

const Tensor<Index, 2> confusion = testing_analysis.calculate_confusion();

neural_network.calculate_outputs(inputs.data(), inputs_dimensions, outputs.data(), outputs_dimensions);
outputs = neural_network.calculate_outputs(inputs.data(), inputs_dimensions);

cout << "\nInputs:\n" << inputs << endl;

cout << "\nOutputs:\n" << outputs << endl;

cout << "\nConfusion matrix:\n" << confusion << endl;
*/


cout << "Bye!" << endl;

Expand Down
1 change: 1 addition & 0 deletions examples/object_detector/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ int main(int argc, char *argv[])
{
cout << "OpenNN. Region Based Object Detector Example." << endl;

// UNDER DEVELOPMENT

srand(time(NULL));
/*
Expand Down

0 comments on commit a195cc3

Please sign in to comment.