Optimazation is done
This commit is contained in:
@@ -64,6 +64,7 @@
|
||||
#include <math/equal.hpp>
|
||||
#include <math/mean.hpp>
|
||||
#include <neural_network/activation_loss/activation_softmax_loss_categorical_crossentropy.hpp>
|
||||
#include <math/sqrt.hpp>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@@ -709,8 +710,9 @@ int main(void) {
|
||||
panic::types::uint_t classes = 3;
|
||||
|
||||
|
||||
// create spiral data
|
||||
// create spiral data
|
||||
panic::neural_network::spiral_data(samples, classes, X, y);
|
||||
//panic::neural_network::vertical_data(samples, classes, X, y);
|
||||
|
||||
// Initilise my model
|
||||
panic::neural_network::model mymodel;
|
||||
@@ -741,10 +743,42 @@ int main(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! mymodel.add_optimizer_sgd()){
|
||||
/*
|
||||
panic::types::real_t learning_rate = 1;
|
||||
panic::types::real_t decay = 1e-3;
|
||||
panic::types::real_t momentum = 0.9;
|
||||
if (! mymodel.add_optimizer_sgd(learning_rate, decay, momentum)){
|
||||
return false;
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
panic::types::real_t learning_rate = 1;
|
||||
panic::types::real_t decay = 1e-4;
|
||||
panic::types::real_t epsilon = 1e-7;
|
||||
if (! mymodel.add_optimizer_adagrad(learning_rate, decay, epsilon)){
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
panic::types::real_t learning_rate = 0.001;
|
||||
panic::types::real_t decay = 1e-4;
|
||||
panic::types::real_t epsilon = 1e-7;
|
||||
panic::types::real_t rho = 0.999;
|
||||
if (! mymodel.add_optimizer_rmsprop(learning_rate, decay, epsilon, rho)){
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
panic::types::real_t learning_rate = 0.02;
|
||||
panic::types::real_t decay = 1e-5;
|
||||
panic::types::real_t epsilon = 1e-7;
|
||||
panic::types::real_t beta_1 = 0.9;
|
||||
panic::types::real_t beta_2 = 0.999;
|
||||
|
||||
if (! mymodel.add_optimizer_adam(learning_rate, decay, epsilon, beta_1, beta_2)){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mymodel.finalize()){
|
||||
return false;
|
||||
}
|
||||
@@ -752,15 +786,13 @@ int main(void) {
|
||||
|
||||
|
||||
panic::types::uint_t epochs = 10000;
|
||||
panic::types::uint_t print_every = 100;
|
||||
panic::types::uint_t print_every = 250;
|
||||
|
||||
if (!mymodel.train(X, y, epochs, print_every)){
|
||||
std::cout << "Training failed" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user