XCSF  1.4.7
XCSF learning classifier system
neural_layer_args.h
Go to the documentation of this file.
1 /*
2  * This program is free software: you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation, either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program. If not, see <http://www.gnu.org/licenses/>.
14  */
15 
24 #pragma once
25 
26 #include "utils.h"
27 
31 struct ArgsLayer {
32  int type;
33  int n_inputs;
34  int n_init;
35  int n_max;
37  int function;
39  int height;
40  int width;
41  int channels;
42  int size;
43  int stride;
44  int pad;
45  double eta;
46  double eta_min;
47  double momentum;
48  double decay;
49  double probability;
50  double scale;
54  _Bool evolve_eta;
56  _Bool sgd_weights;
57  struct ArgsLayer *next;
58 };
59 
60 void
61 layer_args_init(struct ArgsLayer *args);
62 
63 struct ArgsLayer *
64 layer_args_copy(const struct ArgsLayer *src);
65 
66 struct ArgsLayer *
67 layer_args_tail(struct ArgsLayer *head);
68 
69 char *
70 layer_args_json_import(struct ArgsLayer *largs, cJSON *json);
71 
72 char *
73 layer_args_json_export(struct ArgsLayer *args);
74 
75 void
76 layer_args_free(struct ArgsLayer **largs);
77 
78 void
79 layer_args_validate(struct ArgsLayer *args);
80 
81 uint32_t
82 layer_args_opt(const struct ArgsLayer *args);
83 
84 size_t
85 layer_args_save(const struct ArgsLayer *args, FILE *fp);
86 
87 size_t
88 layer_args_load(struct ArgsLayer **largs, FILE *fp);
char * layer_args_json_export(struct ArgsLayer *args)
Returns a json formatted string of the neural layer parameters.
size_t layer_args_load(struct ArgsLayer **largs, FILE *fp)
Loads neural network layer parameters.
void layer_args_init(struct ArgsLayer *args)
Sets layer parameters to default values.
struct ArgsLayer * layer_args_tail(struct ArgsLayer *head)
Returns the current output layer arguments.
uint32_t layer_args_opt(const struct ArgsLayer *args)
Returns a bitstring representing the permissions granted by a layer.
char * layer_args_json_import(struct ArgsLayer *largs, cJSON *json)
Sets the layer parameters from a cJSON object.
void layer_args_free(struct ArgsLayer **largs)
Frees memory used by a list of layer parameters and points to NULL.
size_t layer_args_save(const struct ArgsLayer *args, FILE *fp)
Saves neural network layer parameters.
void layer_args_validate(struct ArgsLayer *args)
Checks network layer arguments are valid.
struct ArgsLayer * layer_args_copy(const struct ArgsLayer *src)
Creates and returns a copy of specified layer parameters.
Parameters for initialising a neural network layer.
_Bool evolve_weights
Ability to evolve weights.
int n_init
Initial number of units / neurons / filters.
_Bool evolve_neurons
Ability to evolve number of units.
_Bool sgd_weights
Ability to update weights with gradient descent.
_Bool evolve_functions
Ability to evolve activation function.
double decay
Weight decay for gradient descent.
double momentum
Momentum for gradient descent.
_Bool evolve_eta
Ability to evolve gradient descent rate.
int max_neuron_grow
Maximum number neurons to add per mutation event.
double probability
Usage depends on layer implementation.
double eta
Gradient descent rate.
int pad
Pool and Conv.
double eta_min
Current gradient descent rate.
int channels
Pool, Conv, and Upsample.
int n_max
Maximum number of units / neurons.
double scale
Usage depends on layer implementation.
int size
Pool and Conv.
int width
Pool, Conv, and Upsample.
int height
Pool, Conv, and Upsample.
int stride
Pool, Conv, and Upsample.
int n_inputs
Number of inputs.
int type
Layer type: CONNECTED, DROPOUT, etc.
struct ArgsLayer * next
Next layer parameters.
_Bool evolve_connect
Ability to evolve weight connectivity.
int recurrent_function
Recurrent activation function.
Utility functions for random number handling, etc.