alib
Universal C Library Collection for Machine Learning & Artificial Intelligence
|
A simple dataset management and manipulation library header. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
Data Structures | |
struct | data |
Structure to hold dataset information. More... | |
Typedefs | |
typedef struct data | data |
Structure to hold dataset information. | |
Functions | |
int | compare_ints (const void *a, const void *b) |
Compare two integers (for use with qsort). | |
void | data_free (data *data) |
Free the memory allocated for the data structure. | |
void | data_mix_training_indices (data *data) |
Randomly shuffle the training instance indices. | |
void | data_print_features (data *data) |
Print the feature names of the dataset. | |
void | data_print_instances (data *data) |
Print all instances in the dataset. | |
void | data_print_scaled_instances (data *data) |
Print all scaled instances in the dataset. | |
void | data_print_target_indices (data *data) |
Print the indices of instances for each target. | |
void | data_print_targets (data *data) |
Print the target names of the dataset. | |
void | data_print_test_indices (data *data) |
Print the test instance indices. | |
void | data_print_train_indices (data *data) |
Print the training instance indices. | |
data * | data_read_from_csv (const char *fname, double train_percentage) |
Read dataset from a CSV file and split into training and test sets. | |
void | data_sort_training_indices (data *data) |
Sort the training instance indices. | |
void | print_data_info (data *data) |
Print general information about the dataset. | |
A simple dataset management and manipulation library header.
This file contains the declarations of functions and structures used for managing and manipulating datasets, including reading from CSV files, printing dataset information, and managing training and test data splits. The implementations of these functions are included in the compiled library lib/libdata.so
.
Definition in file data.h.
typedef struct data data |
Structure to hold dataset information.
This structure contains various fields to store dataset information such as feature names, target labels, instances, and their respective properties.
int compare_ints | ( | const void * | a, |
const void * | b ) |
Compare two integers (for use with qsort).
This function compares two integers and returns a value indicating their relative order.
a | Pointer to the first integer. |
b | Pointer to the second integer. |
void data_free | ( | data * | data | ) |
Free the memory allocated for the data structure.
This function frees all dynamically allocated memory associated with the data structure.
data | The data structure to be freed. |
void data_mix_training_indices | ( | data * | data | ) |
Randomly shuffle the training instance indices.
This function randomly shuffles the indices of the training instances.
data | The data structure containing the dataset. |
void data_print_features | ( | data * | data | ) |
Print the feature names of the dataset.
This function prints the names of the features in the dataset.
data | The data structure containing the dataset. |
void data_print_instances | ( | data * | data | ) |
Print all instances in the dataset.
This function prints all instances in the dataset.
data | The data structure containing the dataset. |
void data_print_scaled_instances | ( | data * | data | ) |
Print all scaled instances in the dataset.
This function prints all scaled instances in the dataset.
data | The data structure containing the dataset. |
void data_print_target_indices | ( | data * | data | ) |
Print the indices of instances for each target.
This function prints the indices of instances for each target class in the dataset.
data | The data structure containing the dataset. |
void data_print_targets | ( | data * | data | ) |
Print the target names of the dataset.
This function prints the names of the target classes in the dataset.
data | The data structure containing the dataset. |
void data_print_test_indices | ( | data * | data | ) |
Print the test instance indices.
This function prints the indices of the instances used for testing.
data | The data structure containing the dataset. |
void data_print_train_indices | ( | data * | data | ) |
Print the training instance indices.
This function prints the indices of the instances used for training.
data | The data structure containing the dataset. |
data * data_read_from_csv | ( | const char * | fname, |
double | train_percentage ) |
Read dataset from a CSV file and split into training and test sets.
This function reads the dataset from the specified CSV file and splits it into training and test sets based on the given train_percentage.
fname | The filename of the CSV file. |
train_percentage | The percentage of data to be used for training. |
void data_sort_training_indices | ( | data * | data | ) |
Sort the training instance indices.
This function sorts the indices of the training instances in ascending order.
data | The data structure containing the dataset. |
void print_data_info | ( | data * | data | ) |
Print general information about the dataset.
This function prints general information about the dataset, such as the number of features, targets, and instances.
data | The data structure containing the dataset. |