Ir para conteúdo
Fórum Script Brasil

saharayoub

Membros
  • Total de itens

    1
  • Registro em

  • Última visita

Sobre saharayoub

saharayoub's Achievements

0

Reputação

  1. Sou iniciante no forum e tenho que fazer um programa que simule redes neurais em c++. Estou usando o Dev C++ e baixei a biblioteca famm más não consigo usa ela no DEV C++ como devo proceder? Já instalei pelo package manager e não dá certo. #include <stdio.h> #include "fann.h" int FANN_API test_callback(struct fann *ann, struct fann_train_data *train, unsigned int max_epochs, unsigned int epochs_between_reports, float desired_error, unsigned int epochs) { printf("Epochs %8d. MSE: %.5f. Desired-MSE: %.5f\n", epochs, fann_get_MSE(ann), desired_error); return 0; } int main() { fann_type *calc_out; const unsigned int num_input = 2; const unsigned int num_output = 1; const unsigned int num_layers = 3; const unsigned int num_neurons_hidden = 3; const float desired_error = (const float) 0; const unsigned int max_epochs = 1000; const unsigned int epochs_between_reports = 10; struct fann *ann; struct fann_train_data *data; unsigned int i = 0; unsigned int decimal_point; printf("Creating network.\n"); ann = fann_create_standard(num_layers, num_input, num_neurons_hidden, num_output); data = fann_read_train_from_file("xor.data"); fann_set_activation_steepness_hidden(ann, 1); fann_set_activation_steepness_output(ann, 1); fann_set_activation_function_hidden(ann, FANN_SIGMOID_SYMMETRIC); fann_set_activation_function_output(ann, FANN_SIGMOID_SYMMETRIC); fann_set_train_stop_function(ann, FANN_STOPFUNC_BIT); fann_set_bit_fail_limit(ann, 0.01f); fann_set_training_algorithm(ann, FANN_TRAIN_RPROP); fann_init_weights(ann, data); printf("Training network.\n"); fann_train_on_data(ann, data, max_epochs, epochs_between_reports, desired_error); printf("Testing network. %f\n", fann_test_data(ann, data)); for(i = 0; i < fann_length_train_data(data); i++) { calc_out = fann_run(ann, data->input); printf("XOR test (%f,%f) -> %f, should be %f, difference=%f\n", data->input[0], data->input[1], calc_out[0], data->output[0], fann_abs(calc_out[0] - data->output[0])); } printf("Saving network.\n"); fann_save(ann, "xor_float.net"); decimal_point = fann_save_to_fixed(ann, "xor_fixed.net"); fann_save_train_to_fixed(data, "xor_fixed.data", decimal_point); printf("Cleaning up.\n"); fann_destroy_train(data); fann_destroy(ann); return 0; }
×
×
  • Criar Novo...