core/data/csv_dataset library

Tabular CSV dataset for regression and classification.

Reads a UTF-8 CSV file with one example per row. Each row is split into features (numeric columns) and an optional label (either a numeric target for regression or a class index for classification):

  • If labelColumn is null, every column is treated as a feature and label on each item is -1.
  • If labelColumn is an int, that column is peeled off as the label and the remaining columns become the feature vector.
  • A classMap may be provided to map string class names to integer indices when the label column is categorical text.

Numeric parsing uses double.tryParse; unparseable cells are filled with 0.0 (regression) or trigger a FormatException on the label column.

Every item is a CsvSample of one [numFeatures] feature Tensor and a scalar label. Tensors are built on the requested device.