-
Notifications
You must be signed in to change notification settings - Fork 382
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
4c62609
1b2a009
553a9a5
32cb043
a3863a7
cc68429
e0c83d0
c169f27
4fbe9c8
97882a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,6 +181,7 @@ int fann_save_internal_fd(struct fann *ann, FILE * conf, const char *configurati | |
fprintf(conf, "network_type=%u\n", ann->network_type); | ||
|
||
fprintf(conf, "learning_momentum=%f\n", ann->learning_momentum); | ||
fprintf(conf, "learning_l2_norm=%f\n", ann->learning_l2_norm); | ||
fprintf(conf, "training_algorithm=%u\n", ann->training_algorithm); | ||
fprintf(conf, "train_error_function=%u\n", ann->train_error_function); | ||
fprintf(conf, "train_stop_function=%u\n", ann->train_stop_function); | ||
|
@@ -443,6 +444,7 @@ struct fann *fann_create_from_fd(FILE * conf, const char *configuration_file) | |
fann_scanf("%u", "network_type", &tmpVal); | ||
ann->network_type = (enum fann_nettype_enum)tmpVal; | ||
fann_scanf("%f", "learning_momentum", &ann->learning_momentum); | ||
fann_scanf("%f", "learning_l2_norm", &ann->learning_l2_norm); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as for |
||
fann_scanf("%u", "training_algorithm", &tmpVal); | ||
ann->training_algorithm = (enum fann_train_enum)tmpVal; | ||
fann_scanf("%u", "train_error_function", &tmpVal); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -978,7 +978,7 @@ void fann_update_weights_irpropm(struct fann *ann, unsigned int first_weight, un | |
for(; i != past_end; i++) | ||
{ | ||
prev_step = fann_max(prev_steps[i], (fann_type) 0.0001); /* prev_step may not be zero because then the training will stop */ | ||
slope = train_slopes[i]; | ||
slope = train_slopes[i] - ann->learning_l2_norm * weights[i]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This only adds the L2 regularization to the irpropm algorithm. The same term should be added to the other |
||
prev_slope = prev_train_slopes[i]; | ||
|
||
same_sign = prev_slope * slope; | ||
|
@@ -1294,3 +1294,5 @@ FANN_GET_SET(float, sarprop_temperature) | |
FANN_GET_SET(enum fann_stopfunc_enum, train_stop_function) | ||
FANN_GET_SET(fann_type, bit_fail_limit) | ||
FANN_GET_SET(float, learning_momentum) | ||
FANN_GET_SET(float, learning_l2_norm) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -491,6 +491,7 @@ struct fann | |
|
||
/* The learning momentum used for backpropagation algorithm. */ | ||
float learning_momentum; | ||
float learning_l2_norm; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is |
||
|
||
/* the connection rate of the network | ||
* between 0 and 1, 1 meaning fully connected | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -769,7 +769,8 @@ FANN_EXTERNAL float FANN_API fann_get_learning_momentum(struct fann *ann); | |
This function appears in FANN >= 2.0.0. | ||
*/ | ||
FANN_EXTERNAL void FANN_API fann_set_learning_momentum(struct fann *ann, float learning_momentum); | ||
|
||
FANN_EXTERNAL float FANN_API fann_get_learning_l2_norm(struct fann *ann); | ||
FANN_EXTERNAL void FANN_API fann_set_learning_l2_norm(struct fann *ann, float learning_l2_norm); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These functions are external and should be documented. |
||
|
||
/* Function: fann_get_activation_function | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any versioning concerns here or are we free to break reading of ANN files that have been written with an older library version?