|
XCSF 1.4.8
XCSF learning classifier system
|
Supervised regression learning functions. More...
#include "xcs_supervised.h"#include "clset.h"#include "ea.h"#include "loss.h"#include "pa.h"#include "param.h"#include "perf.h"#include "utils.h"Go to the source code of this file.
Functions | |
| static int | xcs_supervised_sample (const struct Input *data, const int cnt, const bool shuffle) |
| Selects a data sample for training or testing. | |
| static void | xcs_supervised_trial (struct XCSF *xcsf, const double *x, const double *y, const double *cover) |
| Executes a single XCSF trial. | |
| double | xcs_supervised_fit (struct XCSF *xcsf, const struct Input *train_data, const struct Input *test_data, const bool shuffle, const int start, const int trials) |
| Executes MAX_TRIALS number of XCSF learning iterations using the training data and test iterations using the test data. | |
| void | xcs_supervised_predict (struct XCSF *xcsf, const double *x, double *pred, const int n_samples, const double *cover) |
| Calculates the XCSF predictions for the provided input. | |
| double | xcs_supervised_score (struct XCSF *xcsf, const struct Input *data, const double *cover) |
| Calculates the XCSF error for the input data. | |
| double | xcs_supervised_score_n (struct XCSF *xcsf, const struct Input *data, const int N, const double *cover) |
| Calculates the XCSF error for a subsample of the input data. | |
Supervised regression learning functions.
Definition in file xcs_supervised.c.
| double xcs_supervised_fit | ( | struct XCSF * | xcsf, |
| const struct Input * | train_data, | ||
| const struct Input * | test_data, | ||
| const bool | shuffle, | ||
| const int | start, | ||
| const int | trials | ||
| ) |
Executes MAX_TRIALS number of XCSF learning iterations using the training data and test iterations using the test data.
| [in] | xcsf | The XCSF data structure. |
| [in] | train_data | The input data to use for training. |
| [in] | test_data | The input data to use for testing. |
| [in] | shuffle | Whether to randomise the instances during training. |
| [in] | start | Index to begin sampling. |
| [in] | trials | Number of trials to execute. |
Definition at line 99 of file xcs_supervised.c.
References param_set_explore(), perf_print(), Input::x, Input::x_dim, xcs_supervised_sample(), xcs_supervised_trial(), Input::y, and Input::y_dim.
Referenced by XCS::fit(), and main().
| void xcs_supervised_predict | ( | struct XCSF * | xcsf, |
| const double * | x, | ||
| double * | pred, | ||
| const int | n_samples, | ||
| const double * | cover | ||
| ) |
Calculates the XCSF predictions for the provided input.
| [in] | xcsf | The XCSF data structure. |
| [in] | x | The input feature variables. |
| [out] | pred | The calculated XCSF predictions. |
| [in] | n_samples | The number of instances. |
| [in] | cover | If cover is not NULL and the match set is empty, the prediction array will be set to this value instead of covering. |
Definition at line 141 of file xcs_supervised.c.
References param_set_explore(), and xcs_supervised_trial().
Referenced by XCS::predict().
|
static |
Selects a data sample for training or testing.
| [in] | data | The input data. |
| [in] | cnt | The current sequence counter. |
| [in] | shuffle | Whether to select the sample randomly. |
Definition at line 41 of file xcs_supervised.c.
References Input::n_samples, and rand_uniform_int().
Referenced by xcs_supervised_fit(), and xcs_supervised_score_n().
Calculates the XCSF error for the input data.
| [in] | xcsf | The XCSF data structure. |
| [in] | data | The input data to calculate the error. |
| [in] | cover | If cover is not NULL and the match set is empty, the prediction array will be set to this value instead of covering. |
Definition at line 161 of file xcs_supervised.c.
References Input::n_samples, param_set_explore(), Input::x, Input::x_dim, xcs_supervised_trial(), Input::y, and Input::y_dim.
Referenced by XCS::fit(), XCS::score(), and xcs_supervised_score_n().
| double xcs_supervised_score_n | ( | struct XCSF * | xcsf, |
| const struct Input * | data, | ||
| const int | N, | ||
| const double * | cover | ||
| ) |
Calculates the XCSF error for a subsample of the input data.
| [in] | xcsf | The XCSF data structure. |
| [in] | data | The input data to calculate the error. |
| [in] | N | The maximum number of samples to draw randomly for scoring. |
| [in] | cover | If cover is not NULL and the match set is empty, the prediction array will be set to this value instead of covering. |
Definition at line 185 of file xcs_supervised.c.
References Input::n_samples, param_set_explore(), Input::x, Input::x_dim, xcs_supervised_sample(), xcs_supervised_score(), xcs_supervised_trial(), Input::y, and Input::y_dim.
Referenced by XCS::score().
|
static |
Executes a single XCSF trial.
| [in] | xcsf | The XCSF data structure. |
| [in] | x | The feature variables. |
| [in] | y | The labelled variables. |
| [in] | cover | If cover is not NULL and the match set is empty, the prediction array will be set to this value instead of covering. |
Definition at line 59 of file xcs_supervised.c.
References clset_free(), clset_init(), clset_kill(), clset_match(), clset_update(), ea(), and pa_build().
Referenced by xcs_supervised_fit(), xcs_supervised_predict(), xcs_supervised_score(), and xcs_supervised_score_n().