Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

several improvements #80

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions src/fann_train.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ fann_type fann_activation_derived(unsigned int activation_function,
case FANN_SIGMOID_STEPWISE:
value = fann_clip(value, 0.01f, 0.99f);
return (fann_type) fann_sigmoid_derive(steepness, value);
case FANN_SIGMOID_SYMMETRIC_LECUN:
return (fann_type) fann_sigmoid_symmetric_lecun_derive(steepness, value);
case FANN_SIGMOID_SYMMETRIC:
case FANN_SIGMOID_SYMMETRIC_STEPWISE:
value = fann_clip(value, -0.98f, 0.98f);
Expand Down
2 changes: 1 addition & 1 deletion src/include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
########### install files ###############

INSTALL_FILES( /include FILES fann.h doublefann.h fann_internal.h floatfann.h fann_data.h fixedfann.h compat_time.h fann_activation.h fann_cascade.h fann_error.h fann_train.h fann_io.h fann_cpp.h )
INSTALL_FILES( /include/fann FILES fann.h doublefann.h fann_internal.h floatfann.h fann_data.h fixedfann.h fann_activation.h fann_cascade.h fann_error.h fann_train.h fann_io.h fann_cpp.h )

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bukka Removing compat_time.h seems fine, but do we really want headers to be installed in a "fann" subdirectory?


6 changes: 6 additions & 0 deletions src/include/fann_activation.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define fann_sigmoid_symmetric_real(sum) (2.0f/(1.0f + exp(-2.0f * sum)) - 1.0f)
#define fann_sigmoid_symmetric_derive(steepness, value) steepness * (1.0f - (value*value))

/* FANN_SIGMOID_SYMMETRIC_LECUN */
#define fann_sigmoid_symmetric_lecun_real(sum) sqrt(3.f) * (2.0f/(1.0f + exp(-2.0f * sum)) - 1.0f)
#define fann_sigmoid_symmetric_lecun_derive(steepness, value) steepness * ( sqrt(3.f) - (value*value)/sqrt(3.f) )

/* FANN_GAUSSIAN */
/* #define fann_gaussian(steepness, sum) (exp(-sum * steepness * sum * steepness)) */
#define fann_gaussian_real(sum) (exp(-sum * sum))
Expand Down Expand Up @@ -97,6 +101,8 @@ switch(activation_function) \
case FANN_SIGMOID: \
result = (fann_type)fann_sigmoid_real(value); \
break; \
case FANN_SIGMOID_SYMMETRIC_LECUN: \
result = (fann_type)fann_sigmoid_symmetric_lecun_real(value); \
case FANN_SIGMOID_SYMMETRIC: \
result = (fann_type)fann_sigmoid_symmetric_real(value); \
break; \
Expand Down
6 changes: 4 additions & 2 deletions src/include/fann_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ enum fann_activationfunc_enum
FANN_SIN_SYMMETRIC,
FANN_COS_SYMMETRIC,
FANN_SIN,
FANN_COS
FANN_COS,
FANN_SIGMOID_SYMMETRIC_LECUN
};

/* Constant: FANN_ACTIVATIONFUNC_NAMES
Expand Down Expand Up @@ -256,7 +257,8 @@ static char const *const FANN_ACTIVATIONFUNC_NAMES[] = {
"FANN_SIN_SYMMETRIC",
"FANN_COS_SYMMETRIC",
"FANN_SIN",
"FANN_COS"
"FANN_COS",
"FANN_SIGMOID_SYMMETRIC_LECUN"
};

/* Enum: fann_errorfunc_enum
Expand Down