Update of /cvsroot/pure-data/externals/ann/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28356
Modified Files: ann_mlp.c ann_som.c ann_td.c Log Message: shut down the compiler...
Index: ann_mlp.c =================================================================== RCS file: /cvsroot/pure-data/externals/ann/src/ann_mlp.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ann_mlp.c 18 May 2005 15:53:29 -0000 1.1 --- ann_mlp.c 19 May 2005 14:07:23 -0000 1.2 *************** *** 31,36 **** t_symbol *filename; // name of the file where this ann is saved t_symbol *filenametrain; // name of the file with training data ! float desired_error; ! unsigned int max_iterations; unsigned int iterations_between_reports; t_outlet *l_out, *f_out; --- 31,36 ---- t_symbol *filename; // name of the file where this ann is saved t_symbol *filenametrain; // name of the file with training data ! float desired_error; ! unsigned int max_iterations; unsigned int iterations_between_reports; t_outlet *l_out, *f_out; *************** *** 50,95 ****
void createFann(t_ann_mlp *x, t_symbol *sl, int argc, t_atom *argv) ! { ! unsigned int num_input = 2; ! unsigned int num_output = 1; ! unsigned int num_layers = 3; ! unsigned int num_neurons_hidden = 3; ! float connection_rate = 1; ! float learning_rate = (float)0.7; ! ! if (argc>0) ! num_input = atom_getint(argv++); ! ! if (argc>1) ! num_output = atom_getint(argv++); ! ! if (argc>2) ! num_layers = atom_getint(argv++); ! ! if (argc>3) ! num_neurons_hidden = atom_getint(argv++); ! ! if (argc>4) ! connection_rate = atom_getfloat(argv++); ! ! if (argc>5) ! learning_rate = atom_getfloat(argv++); ! ! if (num_input>=MAXINPUT) ! { ! error("too many inputs, maximum allowed is MAXINPUT"); ! return; ! } ! ! if (num_output>=MAXOUTPUT) ! { ! error("too many outputs, maximum allowed is MAXOUTPUT"); ! return; ! } ! ! x->ann = fann_create(connection_rate, learning_rate, num_layers, ! num_input, num_neurons_hidden, num_output); ! ! fann_set_activation_function_hidden(x->ann, FANN_SIGMOID_SYMMETRIC); fann_set_activation_function_output(x->ann, FANN_SIGMOID_SYMMETRIC);
--- 50,95 ----
void createFann(t_ann_mlp *x, t_symbol *sl, int argc, t_atom *argv) ! { ! unsigned int num_input = 2; ! unsigned int num_output = 1; ! unsigned int num_layers = 3; ! unsigned int num_neurons_hidden = 3; ! float connection_rate = 1; ! float learning_rate = (float)0.7; ! ! if (argc>0) ! num_input = atom_getint(argv++); ! ! if (argc>1) ! num_output = atom_getint(argv++); ! ! if (argc>2) ! num_layers = atom_getint(argv++); ! ! if (argc>3) ! num_neurons_hidden = atom_getint(argv++); ! ! if (argc>4) ! connection_rate = atom_getfloat(argv++); ! ! if (argc>5) ! learning_rate = atom_getfloat(argv++); ! ! if (num_input>=MAXINPUT) ! { ! error("too many inputs, maximum allowed is MAXINPUT"); ! return; ! } ! ! if (num_output>=MAXOUTPUT) ! { ! error("too many outputs, maximum allowed is MAXOUTPUT"); ! return; ! } ! ! x->ann = fann_create(connection_rate, learning_rate, num_layers, ! num_input, num_neurons_hidden, num_output); ! ! fann_set_activation_function_hidden(x->ann, FANN_SIGMOID_SYMMETRIC); fann_set_activation_function_output(x->ann, FANN_SIGMOID_SYMMETRIC);
*************** *** 151,173 ****
void train_on_file(t_ann_mlp *x, t_symbol *sl, int argc, t_atom *argv) ! { if (x->ann == 0) { error("ann not initialized"); return; - } - - if (argc<1) - { - error("you must specify the filename with training data"); - return; - } else - { - x->filenametrain = atom_gensym(argv); } ! ! //post("nn: starting training on file %s, please be patient and wait for my next message (it could take severeal minutes to complete training)", x->filenametrain->s_name); ! ! fann_train_on_file(x->ann, x->filenametrain->s_name, x->max_iterations, x->iterations_between_reports, x->desired_error); --- 151,173 ----
void train_on_file(t_ann_mlp *x, t_symbol *sl, int argc, t_atom *argv) ! { if (x->ann == 0) { error("ann not initialized"); return; } ! ! if (argc<1) ! { ! error("you must specify the filename with training data"); ! return; ! } else ! { ! x->filenametrain = atom_gensym(argv); ! } ! ! //post("nn: starting training on file %s, please be patient and wait for my next message (it could take severeal minutes to complete training)", x->filenametrain->s_name); ! ! fann_train_on_file(x->ann, x->filenametrain->s_name, x->max_iterations, x->iterations_between_reports, x->desired_error); *************** *** 497,502 **** x->f_out = outlet_new(&x->x_obj, &s_float);
! x->desired_error = (float)0.001; ! x->max_iterations = 500000; x->iterations_between_reports = 1000; x->mode=RUN; --- 497,502 ---- x->f_out = outlet_new(&x->x_obj, &s_float);
! x->desired_error = (float)0.001; ! x->max_iterations = 500000; x->iterations_between_reports = 1000; x->mode=RUN; *************** *** 563,565 ****
! } \ No newline at end of file --- 563,565 ----
! }
Index: ann_td.c =================================================================== RCS file: /cvsroot/pure-data/externals/ann/src/ann_td.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ann_td.c 18 May 2005 15:53:29 -0000 1.1 --- ann_td.c 19 May 2005 14:07:23 -0000 1.2 *************** *** 31,36 **** t_symbol *filename; // name of the file where this ann is saved t_symbol *filenametrain; // name of the file with training data ! float desired_error; ! unsigned int max_iterations; unsigned int iterations_between_reports; unsigned int frames; --- 31,36 ---- t_symbol *filename; // name of the file where this ann is saved t_symbol *filenametrain; // name of the file with training data ! float desired_error; ! unsigned int max_iterations; unsigned int iterations_between_reports; unsigned int frames; *************** *** 72,128 ****
void createFann(t_ann_td *x, t_symbol *sl, int argc, t_atom *argv) ! { ! unsigned int num_input = 2; ! unsigned int num_output = 1; ! unsigned int num_layers = 3; ! unsigned int num_neurons_hidden = 3; ! float connection_rate = 1; ! float learning_rate = (float)0.7; ! ! if (argc<3) ! { ! error("you must provide at least num_input, num_output amd frames number"); ! return; ! } ! if (argc>0) ! num_input = atom_getint(argv++); ! ! if (argc>1) ! num_output = atom_getint(argv++); ! ! if (argc>2) ! { ! x->frames = atom_getint(argv++); ! x->ins_frames_set=1; ! } ! ! if (argc>3) ! num_layers = atom_getint(argv++); ! ! if (argc>4) ! num_neurons_hidden = atom_getint(argv++); ! ! if (argc>5) ! connection_rate = atom_getfloat(argv++); ! ! if (argc>6) ! learning_rate = atom_getfloat(argv++); ! ! if ((num_input * x->frames)>=MAXINPUT) ! { ! error("too many inputs, maximum allowed is %f", MAXINPUT/x->frames); ! return; ! } ! ! if (num_output>=MAXOUTPUT) ! { ! error("too many outputs, maximum allowed is MAXOUTPUT"); ! return; ! } ! ! x->ann = fann_create(connection_rate, learning_rate, num_layers, ! (num_input*x->frames), num_neurons_hidden, num_output); ! ! fann_set_activation_function_hidden(x->ann, FANN_SIGMOID_SYMMETRIC); fann_set_activation_function_output(x->ann, FANN_SIGMOID_SYMMETRIC);
--- 72,128 ----
void createFann(t_ann_td *x, t_symbol *sl, int argc, t_atom *argv) ! { ! unsigned int num_input = 2; ! unsigned int num_output = 1; ! unsigned int num_layers = 3; ! unsigned int num_neurons_hidden = 3; ! float connection_rate = 1; ! float learning_rate = (float)0.7; ! ! if (argc<3) ! { ! error("you must provide at least num_input, num_output amd frames number"); ! return; ! } ! if (argc>0) ! num_input = atom_getint(argv++); ! ! if (argc>1) ! num_output = atom_getint(argv++); ! ! if (argc>2) ! { ! x->frames = atom_getint(argv++); ! x->ins_frames_set=1; ! } ! ! if (argc>3) ! num_layers = atom_getint(argv++); ! ! if (argc>4) ! num_neurons_hidden = atom_getint(argv++); ! ! if (argc>5) ! connection_rate = atom_getfloat(argv++); ! ! if (argc>6) ! learning_rate = atom_getfloat(argv++); ! ! if ((num_input * x->frames)>=MAXINPUT) ! { ! error("too many inputs, maximum allowed is %f", MAXINPUT/x->frames); ! return; ! } ! ! if (num_output>=MAXOUTPUT) ! { ! error("too many outputs, maximum allowed is MAXOUTPUT"); ! return; ! } ! ! x->ann = fann_create(connection_rate, learning_rate, num_layers, ! (num_input*x->frames), num_neurons_hidden, num_output); ! ! fann_set_activation_function_hidden(x->ann, FANN_SIGMOID_SYMMETRIC); fann_set_activation_function_output(x->ann, FANN_SIGMOID_SYMMETRIC);
*************** *** 187,209 ****
void train_on_file(t_ann_td *x, t_symbol *sl, int argc, t_atom *argv) ! { if (x->ann == 0) { error("ann not initialized"); return; - } - - if (argc<1) - { - error("you must specify the filename with training data"); - return; - } else - { - x->filenametrain = atom_gensym(argv); } ! ! //post("nn: starting training on file %s, please be patient and wait for my next message (it could take severeal minutes to complete training)", x->filenametrain->s_name); ! ! fann_train_on_file(x->ann, x->filenametrain->s_name, x->max_iterations, x->iterations_between_reports, x->desired_error); --- 187,209 ----
void train_on_file(t_ann_td *x, t_symbol *sl, int argc, t_atom *argv) ! { if (x->ann == 0) { error("ann not initialized"); return; } ! ! if (argc<1) ! { ! error("you must specify the filename with training data"); ! return; ! } else ! { ! x->filenametrain = atom_gensym(argv); ! } ! ! //post("nn: starting training on file %s, please be patient and wait for my next message (it could take severeal minutes to complete training)", x->filenametrain->s_name); ! ! fann_train_on_file(x->ann, x->filenametrain->s_name, x->max_iterations, x->iterations_between_reports, x->desired_error); *************** *** 278,282 **** int i=0; unsigned j=0; - unsigned k=0; //fann_type input[MAXINPUT]; fann_type *calc_out; --- 278,281 ---- *************** *** 576,581 **** x->f_out = outlet_new(&x->x_obj, &s_float);
! x->desired_error = (float)0.001; ! x->max_iterations = 500000; x->iterations_between_reports = 1000; x->mode=RUN; --- 575,580 ---- x->f_out = outlet_new(&x->x_obj, &s_float);
! x->desired_error = (float)0.001; ! x->max_iterations = 500000; x->iterations_between_reports = 1000; x->mode=RUN; *************** *** 663,665 ****
! } \ No newline at end of file --- 662,664 ----
! }
Index: ann_som.c =================================================================== RCS file: /cvsroot/pure-data/externals/ann/src/ann_som.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ann_som.c 12 Apr 2005 13:27:42 -0000 1.5 --- ann_som.c 19 May 2005 14:07:23 -0000 1.6 *************** *** 330,336 ****
freebytes(ap, x->num_sensors*sizeof(t_atom)); - - - }
--- 330,333 ---- *************** *** 758,761 **** --- 755,760 ---- class_addmethod(som_class, (t_method)som_write, gensym("write"), A_GIMME, 0);
+ class_addmethod(som_class, (t_method)som_dump, gensym("dump"), A_FLOAT, 0); + class_addmethod(som_class, (t_method)som_print, gensym("print"), 0); class_addmethod(som_class, (t_method)som_help, gensym("help"), 0);