XCSF 1.4.8
XCSF learning classifier system
Loading...
Searching...
No Matches
act_neural.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 "action.h"
27#include "neural.h"
28#include "neural_activations.h"
29#include "neural_layer.h"
30#include "xcsf.h"
31
35struct ActNeural {
36 struct Net net;
37};
38
39void
41
42char *
43act_neural_param_json_import(struct XCSF *xcsf, cJSON *json);
44
45bool
46act_neural_crossover(const struct XCSF *xcsf, const struct Cl *c1,
47 const struct Cl *c2);
48
49bool
50act_neural_general(const struct XCSF *xcsf, const struct Cl *c1,
51 const struct Cl *c2);
52
53bool
54act_neural_mutate(const struct XCSF *xcsf, const struct Cl *c);
55
56int
57act_neural_compute(const struct XCSF *xcsf, const struct Cl *c,
58 const double *x);
59
60void
61act_neural_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src);
62
63void
64act_neural_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x,
65 const int action);
66
67void
68act_neural_free(const struct XCSF *xcsf, const struct Cl *c);
69
70void
71act_neural_init(const struct XCSF *xcsf, struct Cl *c);
72
73void
74act_neural_print(const struct XCSF *xcsf, const struct Cl *c);
75
76void
77act_neural_update(const struct XCSF *xcsf, const struct Cl *c, const double *x,
78 const double *y);
79
80size_t
81act_neural_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp);
82
83size_t
84act_neural_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp);
85
86char *
87act_neural_json_export(const struct XCSF *xcsf, const struct Cl *c);
88
89void
90act_neural_json_import(const struct XCSF *xcsf, struct Cl *c,
91 const cJSON *json);
92
char * act_neural_json_export(const struct XCSF *xcsf, const struct Cl *c)
Returns a json formatted string representation of a neural action.
Definition act_neural.c:232
size_t act_neural_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp)
Reads a neural network action from a file.
Definition act_neural.c:216
bool act_neural_general(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Dummy function since neural actions do not generalise another.
Definition act_neural.c:76
void act_neural_json_import(const struct XCSF *xcsf, struct Cl *c, const cJSON *json)
Creates a neural action from a cJSON object.
Definition act_neural.c:254
void act_neural_free(const struct XCSF *xcsf, const struct Cl *c)
Frees the memory used by a neural network action.
Definition act_neural.c:167
static struct ActVtbl const act_neural_vtbl
neural action implemented functions.
Definition act_neural.h:96
void act_neural_print(const struct XCSF *xcsf, const struct Cl *c)
Prints a neural network action.
Definition act_neural.c:137
void act_neural_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
Copies a neural network action from one classifier to another.
Definition act_neural.c:122
void act_neural_update(const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y)
Dummy function since neural network actions are not updated.
Definition act_neural.c:183
char * act_neural_param_json_import(struct XCSF *xcsf, cJSON *json)
Sets the neural network parameters from a cJSON object.
Definition act_neural.c:305
int act_neural_compute(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Computes the current neural network action using the input.
Definition act_neural.c:107
void act_neural_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x, const int action)
Generates a neural network that covers the specified input:action.
Definition act_neural.c:152
bool act_neural_crossover(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Dummy function since crossover is not performed on neural actions.
Definition act_neural.c:59
void act_neural_init(const struct XCSF *xcsf, struct Cl *c)
Creates and initialises an action neural network.
Definition act_neural.c:44
void act_neural_param_defaults(struct XCSF *xcsf)
Initialises default neural action parameters.
Definition act_neural.c:270
bool act_neural_mutate(const struct XCSF *xcsf, const struct Cl *c)
Mutates a neural network action.
Definition act_neural.c:92
size_t act_neural_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp)
Writes a neural network action to a file.
Definition act_neural.c:200
Interface for classifier actions.
An implementation of a multi-layer perceptron neural network.
Neural network activation functions.
Interface for neural network layers.
Neural network action data structure.
Definition act_neural.h:35
struct Net net
Neural network.
Definition act_neural.h:36
Action interface data structure.
Definition action.h:76
Classifier data structure.
Definition xcsf.h:45
Neural network data structure.
Definition neural.h:48
XCSF data structure.
Definition xcsf.h:85
XCSF data structures.