XCSF
1.4.7
XCSF learning classifier system
|
CSV input file handling functions. More...
Go to the source code of this file.
Macros | |
#define | MAX_ROWS (100000) |
Maximum number of instances. More... | |
#define | MAX_COLS (200) |
Maximum line length. More... | |
#define | MAX_NAME (200) |
Maximum file name length. More... | |
#define | DELIM (",") |
File delimiter. More... | |
Functions | |
static int | env_csv_samples (FILE *fin) |
Returns the number of samples in a csv file. More... | |
static int | env_csv_dim (FILE *fin) |
Returns the number of dimensions in a csv file. More... | |
static void | env_csv_read_data (FILE *fin, double **data, const int n_samples, const int n_dim) |
Reads the data from a csv file. More... | |
static void | env_csv_read (const char *filename, double **data, int *n_samples, int *n_dim) |
Parses a specified csv file. More... | |
static void | env_csv_input_read (const char *infile, struct Input *train_data, struct Input *test_data) |
Parses specified csv files into training and testing data sets. More... | |
void | env_csv_init (struct XCSF *xcsf, const char *filename) |
Initialises a CSV input environment from a specified filename. More... | |
void | env_csv_free (const struct XCSF *xcsf) |
Frees the csv environment. More... | |
void | env_csv_reset (const struct XCSF *xcsf) |
Dummy method since no csv environment reset is necessary. More... | |
bool | env_csv_is_done (const struct XCSF *xcsf) |
Returns whether the csv environment is in a terminal state. More... | |
const double * | env_csv_get_state (const struct XCSF *xcsf) |
Dummy method since no state is returned by the csv environment. More... | |
double | env_csv_execute (const struct XCSF *xcsf, const int action) |
Dummy method since no action is executed by the csv environment. More... | |
bool | env_csv_multistep (const struct XCSF *xcsf) |
Returns whether the csv environment is a multistep problem. More... | |
double | env_csv_maxpayoff (const struct XCSF *xcsf) |
Returns the maximum payoff value possible in the csv environment. More... | |
CSV input file handling functions.
Definition in file env_csv.c.
|
static |
Returns the number of dimensions in a csv file.
[in] | fin | The csv file. |
Definition at line 54 of file env_csv.c.
References DELIM, and MAX_COLS.
Referenced by env_csv_read().
double env_csv_execute | ( | const struct XCSF * | xcsf, |
const int | action | ||
) |
void env_csv_free | ( | const struct XCSF * | xcsf | ) |
Frees the csv environment.
[in] | xcsf | The XCSF data structure. |
Definition at line 177 of file env_csv.c.
References EnvCSV::test_data, EnvCSV::train_data, Input::x, and Input::y.
const double* env_csv_get_state | ( | const struct XCSF * | xcsf | ) |
void env_csv_init | ( | struct XCSF * | xcsf, |
const char * | filename | ||
) |
Initialises a CSV input environment from a specified filename.
[in] | xcsf | The XCSF data structure. |
[in] | filename | The file name of the csv data. |
Definition at line 160 of file env_csv.c.
References env_csv_input_read(), param_init(), EnvCSV::test_data, EnvCSV::train_data, Input::x_dim, and Input::y_dim.
Referenced by env_init().
|
static |
Parses specified csv files into training and testing data sets.
[in] | infile | The base name of the csv files to read. |
[out] | train_data | The data structure to load the training data. |
[out] | test_data | The data structure to load the testing data. |
Definition at line 138 of file env_csv.c.
References env_csv_read(), MAX_NAME, Input::n_samples, Input::x, Input::x_dim, Input::y, and Input::y_dim.
Referenced by env_csv_init().
bool env_csv_is_done | ( | const struct XCSF * | xcsf | ) |
double env_csv_maxpayoff | ( | const struct XCSF * | xcsf | ) |
bool env_csv_multistep | ( | const struct XCSF * | xcsf | ) |
|
static |
Parses a specified csv file.
Provided a file name will set the data, n_samples, and n_dim.
[in] | filename | The name of the csv file to read. |
[out] | data | A data structure to store the data. |
[out] | n_samples | The number of samples in the dataset. |
[out] | n_dim | The number of dimensions in the dataset. |
Definition at line 110 of file env_csv.c.
References env_csv_dim(), env_csv_read_data(), and env_csv_samples().
Referenced by env_csv_input_read().
|
static |
Reads the data from a csv file.
[in] | fin | The csv file. |
[out] | data | The read data. |
[in] | n_samples | The number of samples. |
[in] | n_dim | The number of dimensions. |
Definition at line 80 of file env_csv.c.
References DELIM, and MAX_COLS.
Referenced by env_csv_read().
void env_csv_reset | ( | const struct XCSF * | xcsf | ) |
|
static |
Returns the number of samples in a csv file.
[in] | fin | The csv file. |
Definition at line 38 of file env_csv.c.
References MAX_COLS.
Referenced by env_csv_read().