XCSF  1.4.7
XCSF learning classifier system
pred_constant.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 "prediction.h"
27 #include "xcsf.h"
28 
29 bool
30 pred_constant_crossover(const struct XCSF *xcsf, const struct Cl *c1,
31  const struct Cl *c2);
32 
33 bool
34 pred_constant_mutate(const struct XCSF *xcsf, const struct Cl *c);
35 
36 double
37 pred_constant_size(const struct XCSF *xcsf, const struct Cl *c);
38 
39 size_t
40 pred_constant_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp);
41 
42 size_t
43 pred_constant_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp);
44 
45 void
46 pred_constant_compute(const struct XCSF *xcsf, const struct Cl *c,
47  const double *x);
48 
49 void
50 pred_constant_copy(const struct XCSF *xcsf, struct Cl *dest,
51  const struct Cl *src);
52 
53 void
54 pred_constant_free(const struct XCSF *xcsf, const struct Cl *c);
55 
56 void
57 pred_constant_init(const struct XCSF *xcsf, struct Cl *c);
58 
59 void
60 pred_constant_print(const struct XCSF *xcsf, const struct Cl *c);
61 
62 void
63 pred_constant_update(const struct XCSF *xcsf, const struct Cl *c,
64  const double *x, const double *y);
65 
66 char *
67 pred_constant_json_export(const struct XCSF *xcsf, const struct Cl *c);
68 
69 void
70 pred_constant_json_import(const struct XCSF *xcsf, struct Cl *c,
71  const cJSON *json);
72 
76 static struct PredVtbl const pred_constant_vtbl = {
84 };
Definition: __init__.py:1
size_t pred_constant_load(const struct XCSF *xcsf, struct Cl *c, FILE *fp)
Dummy function since constant predictions have no data structure.
void pred_constant_init(const struct XCSF *xcsf, struct Cl *c)
Dummy function since constant predictions have no data structure.
Definition: pred_constant.c:33
void pred_constant_free(const struct XCSF *xcsf, const struct Cl *c)
Dummy function since constant predictions have no data structure.
Definition: pred_constant.c:60
void pred_constant_compute(const struct XCSF *xcsf, const struct Cl *c, const double *x)
Dummy function since constant predictions are not computed.
Definition: pred_constant.c:97
void pred_constant_json_import(const struct XCSF *xcsf, struct Cl *c, const cJSON *json)
Creates a constant prediction from a cJSON object.
bool pred_constant_crossover(const struct XCSF *xcsf, const struct Cl *c1, const struct Cl *c2)
Dummy function since constant predictions do not perform crossover.
double pred_constant_size(const struct XCSF *xcsf, const struct Cl *c)
Returns the size of a constant prediction.
void pred_constant_print(const struct XCSF *xcsf, const struct Cl *c)
Prints a constant prediction.
void pred_constant_update(const struct XCSF *xcsf, const struct Cl *c, const double *x, const double *y)
Updates a constant prediction for a given input and truth sample.
Definition: pred_constant.c:74
bool pred_constant_mutate(const struct XCSF *xcsf, const struct Cl *c)
Dummy function since constant predictions do not perform mutation.
static struct PredVtbl const pred_constant_vtbl
Constant prediction implemented functions.
Definition: pred_constant.h:76
void pred_constant_copy(const struct XCSF *xcsf, struct Cl *dest, const struct Cl *src)
Dummy function since constant predictions have no data structure.
Definition: pred_constant.c:46
char * pred_constant_json_export(const struct XCSF *xcsf, const struct Cl *c)
Returns a json formatted string representation of a prediction.
size_t pred_constant_save(const struct XCSF *xcsf, const struct Cl *c, FILE *fp)
Dummy function since constant predictions have no data structure.
Interface for classifier predictions.
Classifier data structure.
Definition: xcsf.h:45
Prediction interface data structure.
Definition: prediction.h:96
XCSF data structure.
Definition: xcsf.h:85
XCSF data structures.