[libfann] 178/242: a candidate training that works somewhat, but which have some issues with signs

Christian Kastner chrisk-guest at moszumanska.debian.org
Sat Oct 4 21:10:40 UTC 2014


This is an automated email from the git hooks/post-receive script.

chrisk-guest pushed a commit to tag Version2_0_0
in repository libfann.

commit f99121c1ce55d4b6f7b78d3d7dce636d02e3b2f7
Author: Steffen Nissen <lukesky at diku.dk>
Date:   Mon May 23 20:49:49 2005 +0000

    a candidate training that works somewhat, but which have some issues with signs
---
 config.guess             | 20 ++++++++++++++++----
 config.sub               | 19 +++++++++++--------
 doc/menu.html            |  6 +++---
 examples/cascade_train.c | 19 +++++++++++--------
 ltmain.sh                |  8 ++++----
 src/fann_cascade.c       | 38 ++++++++++++++++++++------------------
 src/fann_train.c         |  2 +-
 7 files changed, 66 insertions(+), 46 deletions(-)

diff --git a/config.guess b/config.guess
index 8229471..45bee13 100755
--- a/config.guess
+++ b/config.guess
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
-timestamp='2004-11-12'
+timestamp='2005-04-22'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -53,7 +53,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
@@ -804,6 +804,9 @@ EOF
     i*:UWIN*:*)
 	echo ${UNAME_MACHINE}-pc-uwin
 	exit 0 ;;
+    amd64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit 0 ;;
     p*:CYGWIN*:*)
 	echo powerpcle-unknown-cygwin
 	exit 0 ;;
@@ -1137,6 +1140,10 @@ EOF
 	# From seanf at swdc.stratus.com.
 	echo i860-stratus-sysv4
 	exit 0 ;;
+    i*86:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit 0 ;;
     *:VOS:*:*)
 	# From Paul.Green at stratus.com.
 	echo hppa1.1-stratus-vos
@@ -1197,6 +1204,9 @@ EOF
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit 0 ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit 0 ;;
     NSR-?:NONSTOP_KERNEL:*:*)
 	echo nsr-tandem-nsk${UNAME_RELEASE}
 	exit 0 ;;
@@ -1413,7 +1423,9 @@ This script, last modified $timestamp, has failed to recognize
 the operating system you are using. It is advised that you
 download the most up to date version of the config scripts from
 
-    ftp://ftp.gnu.org/pub/gnu/config/
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
 
 If the version you run ($0) is already up to date, please
 send the following data and any information you think might be
diff --git a/config.sub b/config.sub
index 0f84ac2..87a1ee4 100755
--- a/config.sub
+++ b/config.sub
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
-timestamp='2004-11-30'
+timestamp='2005-04-22'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -70,7 +70,7 @@ Report bugs and patches to <config-patches at gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
@@ -231,13 +231,14 @@ case $basic_machine in
 	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| am33_2.0 \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+	| bfin \
 	| c4x | clipper \
 	| d10v | d30v | dlx | dsp16xx \
 	| fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
 	| ip2k | iq2000 \
-	| m32r | m32rle | m68000 | m68k | m88k | mcore \
+	| m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
 	| mips | mipsbe | mipseb | mipsel | mipsle \
 	| mips16 \
 	| mips64 | mips64el \
@@ -262,7 +263,8 @@ case $basic_machine in
 	| pyramid \
 	| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
-	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv8 | sparcv9 | sparcv9b \
+	| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b \
 	| strongarm \
 	| tahoe | thumb | tic4x | tic80 | tron \
 	| v850 | v850e \
@@ -298,7 +300,7 @@ case $basic_machine in
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* \
-	| bs2000-* \
+	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
 	| clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
@@ -310,7 +312,7 @@ case $basic_machine in
 	| ip2k-* | iq2000-* \
 	| m32r-* | m32rle-* \
 	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | mcore-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* \
 	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
 	| mips16-* \
 	| mips64-* | mips64el-* \
@@ -336,7 +338,8 @@ case $basic_machine in
 	| romp-* | rs6000-* \
 	| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
 	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
 	| tahoe-* | thumb-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
diff --git a/doc/menu.html b/doc/menu.html
index f740b7b..5d73791 100644
--- a/doc/menu.html
+++ b/doc/menu.html
@@ -29,9 +29,9 @@ function makeFrame()
   <a href="html/index.html" target="viewer">Reference Manual</a> ›<br>
   <a href="fann.html" target="viewer">Ref Man (single file)</a> ›<br>
   <a href="fann.pdf" target="viewer">Reference Manual PDF</a> ›<br>
-  <a href="fann_en.pdf" target="viewer">Article (English)</a> ›<br>
-  <a href="fann_fr.pdf" target="viewer">Article (French)</a> ›<br>
-  <a href="fann_en.pdf" target="viewer">Article (Polish)</a> ›<br><br>
+  <a href="fann_en.pdf" target="viewer">Intro-article (English)</a> ›<br>
+  <a href="fann_fr.pdf" target="viewer">Intro-article (French)</a> ›<br>
+  <a href="fann_en.pdf" target="viewer">Intro-article (Polish)</a> ›<br><br>
 
 
   <a href="http://www.geocities.com/freegoldbar/indexExplorer.html" target="viewer">Graphical Interface</a> ›<br>
diff --git a/examples/cascade_train.c b/examples/cascade_train.c
index b11d415..ac37d9f 100644
--- a/examples/cascade_train.c
+++ b/examples/cascade_train.c
@@ -34,20 +34,22 @@ int main()
 	
 	printf("Reading data.\n");
 
-	train_data = fann_read_train_from_file("../benchmarks/datasets/two-spiral2.train");
-	test_data = fann_read_train_from_file("../benchmarks/datasets/two-spiral2.test");
+	/*
+	*/
 
 	/* this is in range -1 to 1 */
 	/*
-	train_data = fann_read_train_from_file("../benchmarks/datasets/parity4.train");
-	test_data = fann_read_train_from_file("../benchmarks/datasets/parity4.test");
 	*/
-
+	
+	train_data = fann_read_train_from_file("../benchmarks/datasets/two-spiral2.train");
+	test_data = fann_read_train_from_file("../benchmarks/datasets/two-spiral2.test");
 	
 	train_data = fann_read_train_from_file("xor.data");
 	test_data = fann_read_train_from_file("xor.data");
-	
 
+	train_data = fann_read_train_from_file("../benchmarks/datasets/parity4.train");
+	test_data = fann_read_train_from_file("../benchmarks/datasets/parity4.test");
+	
 	printf("Creating network.\n");
 
 	ann = fann_create_shortcut(learning_rate, 2, train_data->num_input, train_data->num_output);
@@ -56,13 +58,14 @@ int main()
 	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_activation_function_output(ann, FANN_LINEAR);
+	fann_set_train_error_function(ann, FANN_ERRORFUNC_LINEAR);
 	
 	fann_print_parameters(ann);
 	/*fann_print_connections(ann);*/
 
 	printf("Training network.\n");
-	
+
 	fann_cascadetrain_on_data_callback(ann, train_data, desired_error, NULL, max_out_epochs, max_cand_epochs, max_neurons, neurons_between_reports);
 
 	/*fann_train_on_data(ann, train_data, 300, 1, desired_error);*/
diff --git a/ltmain.sh b/ltmain.sh
index 274587e..1a224ac 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -44,7 +44,7 @@ EXIT_FAILURE=1
 PROGRAM=ltmain.sh
 PACKAGE=libtool
 VERSION=1.5.6
-TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42) Debian$Rev: 220 $"
+TIMESTAMP=" (1.1220.2.95 2004/04/11 05:50:42) Debian$Rev: 224 $"
 
 
 # Check that we have a working $echo.
@@ -2945,7 +2945,7 @@ EOF
 
 	# Check that each of the things are valid numbers.
 	case $current in
-	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
 	*)
 	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
@@ -2954,7 +2954,7 @@ EOF
 	esac
 
 	case $revision in
-	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
 	*)
 	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
@@ -2963,7 +2963,7 @@ EOF
 	esac
 
 	case $age in
-	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
 	*)
 	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
 	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
diff --git a/src/fann_cascade.c b/src/fann_cascade.c
index 75ead61..3bff1ac 100644
--- a/src/fann_cascade.c
+++ b/src/fann_cascade.c
@@ -22,7 +22,7 @@
 
 #ifndef FIXEDFANN
 
-/* #define CASCADE_DEBUG */
+#define CASCADE_DEBUG
 
 void fann_cascadetrain_on_data_callback(struct fann *ann, struct fann_train_data *data, float desired_error, int (*callback)(unsigned int epochs, float error), unsigned int max_out_epochs, unsigned int max_cand_epochs, unsigned int max_neurons, unsigned int neurons_between_reports);
 
@@ -146,7 +146,6 @@ void fann_cascadetrain_on_data_callback(struct fann *ann, struct fann_train_data
 		printf("training outputs\n");
 #endif
 		total_epochs += fann_train_outputs(ann, data, desired_error, max_out_epochs);
-
 		error = fann_get_MSE(ann);
 
 #ifdef CASCADE_DEBUG
@@ -198,9 +197,12 @@ void fann_cascadetrain_on_data_callback(struct fann *ann, struct fann_train_data
 
 		/* this installs the best candidate */
 #ifdef CASCADE_DEBUG
-		printf("install candidate\n");
+		printf("install candidate error (%f)\n", fann_test_data(ann, data));
 #endif
 		fann_install_candidate(ann);
+#ifdef CASCADE_DEBUG
+		printf("candidate installed error (%f)\n", fann_test_data(ann, data));
+#endif
 	}
 
 	/* Train outputs one last time but without any desired error */
@@ -579,12 +581,18 @@ void fann_update_candidate_slopes(struct fann *ann)
 		cand_out_slopes = ann->train_slopes + cand_it->first_con + num_connections;
 		for(j = 0; j < num_output; j++){
 			diff = (activation * cand_out_weights[j]) - output_train_errors[j];
-			printf("diff = %f = (%f * %f) - %f;\n", diff, activation, cand_out_weights[j], output_train_errors[j]);
+#ifdef CASCADE_DEBUG
+			/* printf("diff = %f = (%f * %f) - %f;\n", diff, activation, cand_out_weights[j], output_train_errors[j]); */
+#endif
 			cand_out_slopes[j] += diff * activation;
-			printf("cand_out_slopes[%d] <= %f += %f * %f;\n", j, cand_out_slopes[j], diff, activation);
+#ifdef CASCADE_DEBUG
+			/* printf("cand_out_slopes[%d] <= %f += %f * %f;\n", j, cand_out_slopes[j], diff, activation); */
+#endif
 			error_value += diff * cand_out_weights[j];
 			cand_score -= (diff * diff);
-			printf("cand_score[%d][%d] = %f -= (%f * %f)\n", cand_it - first_cand, j, cand_score, diff, diff);
+#ifdef CASCADE_DEBUG
+			/* printf("cand_score[%d][%d] = %f -= (%f * %f)\n", cand_it - first_cand, j, cand_score, diff, diff); */
+#endif
 		}
 
 		ann->cascade_candidate_scores[cand_it - first_cand] = cand_score;
@@ -614,6 +622,7 @@ float fann_train_candidates_epoch(struct fann *ann, struct fann_train_data *data
 	fann_type *output_train_errors = ann->train_errors + (ann->total_neurons - ann->num_output);
 
 	for(i = 0; i < num_cand; i++){
+		/* The ann->MSE_value is actually the sum squared error */
 		ann->cascade_candidate_scores[i] = ann->MSE_value;
 	}
 	/*printf("start score: %f\n", ann->MSE_value);*/
@@ -623,7 +632,7 @@ float fann_train_candidates_epoch(struct fann *ann, struct fann_train_data *data
 
 		for(j = 0; j < ann->num_output; j++){
 			/* TODO only debug, but the error is in opposite direction, this might be usefull info */
-			/*if(output_train_errors[j] != (ann->output[j] - data->output[i][j])){
+			/*			if(output_train_errors[j] != (ann->output[j] - data->output[i][j])){
 				printf("difference in calculated error at %f != %f; %f = %f - %f;\n", output_train_errors[j], (ann->output[j] - data->output[i][j]), output_train_errors[j], ann->output[j], data->output[i][j]);
 				}*/
 
@@ -638,14 +647,6 @@ float fann_train_candidates_epoch(struct fann *ann, struct fann_train_data *data
 				ann->activation_function_output == FANN_SIGMOID_SYMMETRIC_STEPWISE){
 				output_train_errors[j] /= 2.0;
 			}
-
-			if ( output_train_errors[j] < -.9999999 )
-				output_train_errors[j] = -17.0;
-			else if ( output_train_errors[j] > .9999999 )
-				output_train_errors[j] = 17.0;
-			else
-				output_train_errors[j] = (fann_type)log ( (1.0+output_train_errors[j]) / (1.0-output_train_errors[j]) );
-			
 		}
 
 		fann_update_candidate_slopes(ann);
@@ -664,7 +665,7 @@ float fann_train_candidates_epoch(struct fann *ann, struct fann_train_data *data
 	}
 
 	ann->cascade_best_candidate = ann->total_neurons + best_candidate + 1;
-	/*printf("Best candidate: %d(%d) with score %f, real score: %f\n", ann->cascade_best_candidate, best_candidate, ann->MSE_value-best_score, best_score);*/
+	printf("Best candidate: %d(%d) with score %f, real score: %f\n", ann->cascade_best_candidate, best_candidate, ann->MSE_value-best_score, best_score);
 	
 	return best_score;
 }
@@ -731,7 +732,8 @@ void fann_add_candidate_neuron(struct fann *ann, struct fann_layer *layer)
 	unsigned int num_connections_out = (ann->last_layer-1)->last_neuron - (layer+1)->first_neuron;
 	unsigned int num_connections_move = num_connections_out + num_connections_in;
 
-	unsigned int i, candidate_con, candidate_output_weight;
+	unsigned int candidate_con, candidate_output_weight;
+	int i;
 
 	struct fann_layer *layer_it;
 	struct fann_neuron *neuron_it, *neuron_place, *candidate;
@@ -783,7 +785,7 @@ void fann_add_candidate_neuron(struct fann *ann, struct fann_layer *layer)
 #ifdef CASCADE_DEBUG	
 		printf("move weight[%d ... %d] -> weight[%d ... %d]\n", neuron_it->first_con, neuron_it->last_con-1, neuron_it->first_con + num_connections_move - 1, neuron_it->last_con + num_connections_move - 2);
 #endif
-		for(i = neuron_it->last_con - 1; i >= neuron_it->first_con; i--){
+		for(i = neuron_it->last_con - 1; i >= (int)neuron_it->first_con; i--){
 #ifdef CASCADE_DEBUG	
 			printf("move weight[%d] = weight[%d]\n", i + num_connections_move - 1, i);
 #endif
diff --git a/src/fann_train.c b/src/fann_train.c
index a88826a..c03938d 100644
--- a/src/fann_train.c
+++ b/src/fann_train.c
@@ -680,7 +680,7 @@ void fann_update_weights_irpropm(struct fann *ann, unsigned int first_weight, un
 		prev_step = fann_max(prev_steps[i], (fann_type)0.001); /* prev_step may not be zero because then the training will stop */
 		slope = train_slopes[i];
 		prev_slope = prev_train_slopes[i];
-		next_step = 0.0;
+		/* next_step = 0.0; */
 
 		same_sign = prev_slope * slope;
 	

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/libfann.git



More information about the debian-science-commits mailing list