Skip to content

Instantly share code, notes, and snippets.

-module(fannerl_tests).
-include_lib("eunit/include/eunit.hrl").
create_test() ->
Fann = fannerl:create_standard({2,2,1}),
fannerl:get_training_algorithm(Fann),
?debugMsg("exiting create_test").
get_mse_test() ->
@axling
axling / fann_nif.c
Created February 7, 2011 23:19
the nif code
#include <erl_nif.h>
#include <fann.h>
#include <string.h>
#include <ctype.h>
static ErlNifResourceType * FANN_POINTER=NULL;
static ErlNifResourceType * TRAIN_DATA_THREAD=NULL;
static ErlNifResourceType * TRAIN_DATA_RESOURCE=NULL;
struct fann_resource {
-module(fann_example).
-export([run/0]).
run() ->
Net = fann:create_standard({2,3,1}),
fann:set_activation_function_hidden(Net, 5),
fann:set_activation_function_hidden(Net, 5),
fann:train_on_file(Net, "xor.data", 1000000, 0, 0.001),
Mse = fann:get_mse(Net),
#include <erl_nif.h>
#include <fann.h>
static ErlNifResourceType * FANN_POINTER=NULL;
struct fann_resource {
struct fann * ann;
};
int check_and_convert_array(ErlNifEnv* env, const ERL_NIF_TERM * tuple_array,