XCSF  1.4.7
XCSF learning classifier system
xcsf.c File Reference

System-level functions for initialising, saving, loading, etc. More...

#include "cl.h"
#include "clset.h"
#include "cond_neural.h"
#include "loss.h"
#include "pa.h"
#include "param.h"
#include "pred_neural.h"
Include dependency graph for xcsf.c:

Go to the source code of this file.

Functions

void xcsf_init (struct XCSF *xcsf)
 Initialises XCSF with an empty population. More...
 
void xcsf_free (struct XCSF *xcsf)
 Frees XCSF population sets. More...
 
void xcsf_print_pset (const struct XCSF *xcsf, const bool print_cond, const bool print_act, const bool print_pred)
 Prints the current XCSF population. More...
 
size_t xcsf_save (const struct XCSF *xcsf, const char *filename)
 Writes the current state of XCSF to a file. More...
 
size_t xcsf_load (struct XCSF *xcsf, const char *filename)
 Reads the state of XCSF from a file. More...
 
void xcsf_pred_expand (const struct XCSF *xcsf)
 Inserts a new hidden layer before the output layer within all prediction neural networks in the population. More...
 
void xcsf_ae_to_classifier (struct XCSF *xcsf, const int y_dim, const int n_del)
 Switches from autoencoding to classification. More...
 
void xcsf_store_pset (struct XCSF *xcsf)
 Stores the current population. More...
 
void xcsf_retrieve_pset (struct XCSF *xcsf)
 Retrieves the previously stored population. More...
 

Detailed Description

System-level functions for initialising, saving, loading, etc.

Author
Richard Preen rpree.nosp@m.n@gm.nosp@m.ail.c.nosp@m.om
Date
2015–2020.

Definition in file xcsf.c.

Function Documentation

◆ xcsf_ae_to_classifier()

void xcsf_ae_to_classifier ( struct XCSF xcsf,
const int  y_dim,
const int  n_del 
)

Switches from autoencoding to classification.

Parameters
[in]xcsfThe XCSF data structure.
[in]y_dimThe output dimension (i.e., the number of classes).
[in]n_delThe number of hidden layers to remove.

Definition at line 171 of file xcsf.c.

References Clist::cl, Cl::err, Cl::exp, Cl::fit, LOSS_ONEHOT, Clist::next, pa_free(), pa_init(), param_set_loss_func(), param_set_y_dim(), pred_neural_ae_to_classifier(), Cl::prediction, and Cl::time.

Referenced by XCS::ae_to_classifier().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xcsf_free()

void xcsf_free ( struct XCSF xcsf)

Frees XCSF population sets.

Parameters
[in]xcsfThe XCSF data structure.

Definition at line 56 of file xcsf.c.

References clset_kill(), and pa_free().

Referenced by XCS::fit(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xcsf_init()

void xcsf_init ( struct XCSF xcsf)

Initialises XCSF with an empty population.

Parameters
[in]xcsfThe XCSF data structure.

Definition at line 37 of file xcsf.c.

References clset_init(), clset_pset_init(), and pa_init().

Referenced by XCS::fit(), main(), and XCS::XCS().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xcsf_load()

size_t xcsf_load ( struct XCSF xcsf,
const char *  filename 
)

Reads the state of XCSF from a file.

Parameters
[in]xcsfThe XCSF data structure.
[in]filenameThe name of the input file.
Returns
The total number of elements read.

Definition at line 114 of file xcsf.c.

References clset_init(), clset_kill(), clset_pset_load(), param_load(), VERSION_MAJOR, and VERSION_MINOR.

Referenced by XCS::deserialize(), XCS::load(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xcsf_pred_expand()

void xcsf_pred_expand ( const struct XCSF xcsf)

Inserts a new hidden layer before the output layer within all prediction neural networks in the population.

Parameters
[in]xcsfThe XCSF data structure.

Definition at line 151 of file xcsf.c.

References Clist::cl, Cl::err, Cl::exp, Cl::fit, Clist::next, pred_neural_expand(), and Cl::time.

Referenced by XCS::pred_expand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xcsf_print_pset()

void xcsf_print_pset ( const struct XCSF xcsf,
const bool  print_cond,
const bool  print_act,
const bool  print_pred 
)

Prints the current XCSF population.

Parameters
[in]xcsfThe XCSF data structure.
[in]print_condWhether to print condition structures.
[in]print_actWhether to print action structures.
[in]print_predWhether to print prediction structures.

Definition at line 77 of file xcsf.c.

References clset_print().

Referenced by XCS::print_pset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xcsf_retrieve_pset()

void xcsf_retrieve_pset ( struct XCSF xcsf)

Retrieves the previously stored population.

Parameters
[in]xcsfThe XCSF data structure.

Definition at line 213 of file xcsf.c.

References clset_init(), and clset_kill().

Referenced by EarlyStoppingCallback::retrieve(), and XCS::retrieve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xcsf_save()

size_t xcsf_save ( const struct XCSF xcsf,
const char *  filename 
)

Writes the current state of XCSF to a file.

Parameters
[in]xcsfThe XCSF data structure.
[in]filenameThe name of the output file.
Returns
The total number of elements written.

Definition at line 90 of file xcsf.c.

References clset_pset_save(), param_save(), VERSION_BUILD, VERSION_MAJOR, and VERSION_MINOR.

Referenced by XCS::save(), CheckpointCallback::save(), and XCS::serialize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ xcsf_store_pset()

void xcsf_store_pset ( struct XCSF xcsf)

Stores the current population.

Parameters
[in]xcsfThe XCSF data structure.

Definition at line 195 of file xcsf.c.

References Clist::cl, cl_init_copy(), clset_add(), clset_kill(), and Clist::next.

Referenced by EarlyStoppingCallback::store(), and XCS::store().

Here is the call graph for this function:
Here is the caller graph for this function: