-
Notifications
You must be signed in to change notification settings - Fork 0
Data module
Alessio Faraci edited this page Sep 11, 2025
·
2 revisions
When working with custom datasets, it's essential to follow the specified file structure.
Organize your dataset files as follows:
your_dataset_folder/
├── dataset_x.csv # Complete feature set
├── dataset_y.csv # Complete label set
├── train_x.csv # Training features
├── train_y.csv # Training labels
├── test_x.csv # Test features
└── test_y.csv # Test labels
-
Delimiter: All CSV files must use comma (
,) delimiters. - Headers: Files must not include any headers.
- Structure: Each row must represent a single sample, with columns corresponding to features or targets.
| Function | Description |
|---|---|
load(file_path: Path) |
Loads training and test datasets from CSV files in a specified directory. |
-
Parameters:
-
file_path: Path to the directory containingtrain_x.csv,train_y.csv,test_x.csv,test_y.csv.
-
-
Returns: A tuple of numpy arrays:
(train_x, test_x, train_y, test_y).
Generates synthetic datasets by evaluating a given function on sampled input points.
-
Parameters:
-
bounds: An array of shape(2, dim)specifying the lower and upper bounds. -
fn: The function to evaluate on the generated samples. -
data_size: The total number of samples to generate. -
train_size: The number of training samples. -
file_path: The directory path where the generated data will be saved. -
method(optional): The sampling method to use ("uniform"or"lhs"for Latin Hypercube Sampling). Default is"uniform". -
seed(optional): A random seed for reproducibility.
-
-
Returns: A tuple of the generated datasets:
(train_x, test_x, train_y, test_y).
Splits an existing dataset into training and test sets.
-
Parameters:
-
file_path: The path to the directory containingdataset_x.csvanddataset_y.csv. -
test_size: The proportion of the dataset to be used for testing.
-
-
Returns: A tuple of the split datasets:
(train_x, test_x, train_y, test_y).