std :: ml::datasets
Struct std::Dataset
struct Dataset {
&FloatTensor x;
&FloatTensor y;
unsigned long n;
unsigned long features;
unsigned long targets;
unsigned long classes;
}Fields
[n, features]
[n, targets]
0 for regression / unlabeled
Methods
Shuffles, then puts 'testFraction' of the rows in 'test'.
Mean 0, std 1 per feature column, from the set's own statistics.
The same with this set's statistics applied to it and 'test' (no test leakage).
= drop()
Two interleaved half circles, 2 classes (scikit-learn's make_moons).
static struct Dataset circles(unsigned long n, float noise, float factor, &Rng rng)source · definitionA circle inside a larger one, radius ratio 'factor', 2 classes.
static struct Dataset spirals(
unsigned long n,
unsigned long classes,
float noise,
&Rng rng,
)source · definition'classes' interleaved spiral arms.
static struct Dataset blobs(
unsigned long n,
unsigned long classes,
unsigned long features,
float spread,
&Rng rng,
)source · definitionIsotropic Gaussian clusters in 'features' dimensions, centers in [-5, 5].
The four XOR quadrants of [-1, 1]^2, 2 classes.
Regression: x uniform in [-pi, pi], y = sin(x) + noise.
static struct Dataset gaussian_ring(
unsigned long n,
unsigned long modes,
float radius,
float std,
&Rng rng,
)source · definition'modes' Gaussians (std 'std') evenly spaced on a circle of 'radius'; the label is the mode.
side x side binary images, flattened row-major, pixels 0 or 1. Classes: 0 square outline, 1 plus sign, 2 filled disc, 3 diagonal cross; random size and position. side >= 8.
static struct Dataset load_mnist(
const &char imagesPath,
const &char labelsPath,
unsigned long limit,
)source · definitionMNIST / Fashion-MNIST IDX files (uncompressed): images as [n, 784] scaled to [0, 1], 10 classes. 'limit' 0 reads every image. On any error the result has n == 0.
static struct Dataset load_csv(
const &char path,
long labelColumn,
int hasHeader,
int classification,
)source · definitionA numeric CSV: one row per line, comma-separated. 'labelColumn' -1 makes the set unlabeled; otherwise that column becomes y, and with 'classification' the labels are class indices (classes = max + 1). The first line is skipped when 'hasHeader'. n == 0 on error.