XCSF 1.4.8
XCSF learning classifier system
Loading...
Searching...
No Matches
cond_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 "condition.h"
27#include "neural.h"
28#include "neural_activations.h"
29#include "neural_layer.h"
30#include "xcsf.h"
31
35struct CondNeural {
36 struct Net net;
37};
38
39char *
40cond_neural_param_json_import(struct XCSF *xcsf, cJSON *json);
41
42void
44
45bool
46cond_neural_crossover(const struct XCSF *xcsf, const struct Cl *c1,
47 const struct Cl *c2);
48
49bool
50cond_neural_general(const struct XCSF *xcsf, const struct Cl *c1,
51 const struct Cl *c2);
52
53bool
54cond_neural_match(const struct XCSF *xcsf, const struct Cl *c, const double *x);
55
56bool
57cond_neural_mutate(const struct XCSF *xcsf, const struct Cl *c);
58
59void
60cond_neural_copy(const struct XCSF *xcsf, struct Cl *dest,
61 const struct Cl *src);
62
63void
64cond_neural_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x);
65
66void
67cond_neural_free(const struct XCSF *xcsf, const struct Cl *c);
68
69void
70cond_neural_init(const struct XCSF *xcsf, struct Cl *c);
71
72void
73cond_neural_print(const struct XCSF *xcsf, const struct Cl *c);
74
75void
76cond_neural_update(const struct XCSF *xcsf, const struct Cl *c, const double *x,
77 const double *y);
78
79double
80cond_neural_size(const struct XCSF *xcsf, const struct Cl *c);
81
82size_t
83cond_neural_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp);
84
85size_t
86cond_neural_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp);
87
88int
89cond_neural_neurons(const struct XCSF *xcsf, const struct Cl *c, int layer);
90
91int
92cond_neural_layers(const struct XCSF *xcsf, const struct Cl *c);
93
94int
95cond_neural_connections(const struct XCSF *xcsf, const struct Cl *c, int layer);
96
97char *
98cond_neural_json_export(const struct XCSF *xcsf, const struct Cl *c);
99
100void
101cond_neural_json_import(const struct XCSF *xcsf, struct Cl *c,
102 const cJSON *json);
103
char * cond_neural_json_export(const struct XCSF *xcsf, const struct Cl *c)
Returns a json formatted string representation of a neural condition.
bool cond_neural_general(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Dummy general function.
bool cond_neural_crossover(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Dummy crossover function.
void cond_neural_json_import(const struct XCSF *xcsf, struct Cl *c, const cJSON *json)
Creates a neural condition from a cJSON object.
int cond_neural_neurons(const struct XCSF *xcsf, const struct Cl *c, int layer)
Returns the number of neurons in a neural condition layer.
void cond_neural_init(const struct XCSF *xcsf, struct Cl *c)
Creates and initialises a neural network condition.
Definition cond_neural.c:42
int cond_neural_layers(const struct XCSF *xcsf, const struct Cl *c)
Returns the number of layers within a neural network condition.
void cond_neural_free(const struct XCSF *xcsf, const struct Cl *c)
Frees the memory used by a neural network condition.
Definition cond_neural.c:55
size_t cond_neural_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp)
Writes a neural network condition to a file.
bool cond_neural_match(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Generates a neural network that matches the current input.
double cond_neural_size(const struct XCSF *xcsf, const struct Cl *c)
Returns the size of a neural network condition.
size_t cond_neural_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp)
Reads a neural network condition from a file.
void cond_neural_param_defaults(struct XCSF *xcsf)
Initialises default neural condition parameters.
void cond_neural_update(const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y)
Dummy update function.
static struct CondVtbl const cond_neural_vtbl
Multi-layer perceptron neural network condition implemented functions.
int cond_neural_connections(const struct XCSF *xcsf, const struct Cl *c, int layer)
Returns the number of active connections in a neural condition layer.
bool cond_neural_mutate(const struct XCSF *xcsf, const struct Cl *c)
Mutates a neural network condition with the self-adaptive rates.
void cond_neural_cover(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Generates a neural network that matches the current input.
Definition cond_neural.c:86
void cond_neural_print(const struct XCSF *xcsf, const struct Cl *c)
Prints a neural network condition.
void cond_neural_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
Copies a neural network condition from one classifier to another.
Definition cond_neural.c:70
char * cond_neural_param_json_import(struct XCSF *xcsf, cJSON *json)
Sets the neural network parameters from a cJSON object.
Interface for classifier conditions.
An implementation of a multi-layer perceptron neural network.
Neural network activation functions.
Interface for neural network layers.
Classifier data structure.
Definition xcsf.h:45
Multi-layer perceptron neural network condition data structure.
Definition cond_neural.h:35
struct Net net
Neural network.
Definition cond_neural.h:36
Condition interface data structure.
Definition condition.h:104
Neural network data structure.
Definition neural.h:48
XCSF data structure.
Definition xcsf.h:85
XCSF data structures.