data
// jda::ml::data — DataLoader & Dataset Primitives
Structs
Dataset
struct Dataset {
x: Tensor // shape [N x D_in]
y: Tensor // shape [N x D_out] (or [N] for classification)
n: i64 // number of samples (== x.shape[0])
x_dim: i64 // feature dimension
y_dim: i64 // label dimension
}Sampler
struct Sampler {
indices: []i64
pos: i64
n: i64
}Batch
struct Batch {
x: Tensor // [B x D_in]
y: Tensor // [B x D_out]
size: i64 // actual batch size (may be < requested at epoch end)
}DataLoader
struct DataLoader {
ds: ref Dataset
sampler: own Sampler
batch_size: i64
shuffle: bool
drop_last: bool // skip final incomplete batch
epoch: i64
seed: u64
}Functions
| Function | Description |
|---|---|
one_hot | |
csv_load | |
csv_count_rows | |
csv_count_cols | |
parse_csv_f32 |
Details
one_hot
fn one_hot(classes: ref []i64, n_classes: i64) -> Tensorcsv_load
fn csv_load(path: ref []i8, label_cols: i64) -> Result<own Dataset, []i8>csv_count_rows
fn csv_count_rows(src: ref []i8) -> i64csv_count_cols
fn csv_count_cols(src: ref []i8) -> i64parse_csv_f32
fn parse_csv_f32(src: ref []i8, pos: i64) -> (f32, i64)