Entry point for ML batch loading from a ROOT RDataFrame.
Usage without a validation split::
train = ROOT.Experimental.ML.RDataLoader(df, batch_size=1000, ...)
for x, y in train.as_torch():
...
Usage with a validation split::
dl = ROOT.Experimental.ML.RDataLoader(df, batch_size=1000, ...)
train, val = dl.train_test_split(test_size=0.2)
for x, y in train.as_torch():
...
for x, y in val.as_numpy():
...
Definition at line 605 of file _ml_dataloader.py.
|
| None | __init__ (self, ROOT.RDF.RNode|Spec|Iterable[ROOT.RDF.RNode|Spec] inputs, *int batch_size=64, int batches_in_memory=10, list[str]|None columns=None, dict[str, int]|None max_vec_sizes=None, float vec_padding=0.0, str|list[str]|None target=None, str weights="", bool shuffle=True, bool drop_remainder=True, int set_seed=0, bool load_eager=False, str sampling_type="", float sampling_ratio=1.0, bool replacement=False) |
| | Args: inputs: RDataFrame or (dataset_name, files) tuple, or a list of them, to load from.
|
| |
| FormattedLoader | as_jax (self, str|Any device=None) |
| | Return an iterable that yields batches as JAX arrays.
|
| |
| FormattedLoader | as_numpy (self) |
| | Return an iterable that yields batches as NumPy arrays.
|
| |
| tf.data.Dataset | as_tensorflow (self) |
| | Return a tf.data.Dataset over batches as TensorFlow tensors.
|
| |
| FormattedLoader | as_torch (self, str|torch.device|None device=None) |
| | Return an iterable that yields batches as PyTorch tensors.
|
| |
| list[str] | columns (self) |
| | All column names as they appear in each batch tensor.
|
| |
| list[str] | feature_columns (self) |
| | Feature column names (columns minus target and weights).
|
| |
| int | last_batch_no_of_rows (self) |
| | Number of rows in the last (remainder) batch, 0 if no remainder.
|
| |
| int | num_batches (self) |
| | Total number of batches in this split for one epoch.
|
| |
| None | save (self, str dataset_name, str|os.PathLike filename, *str output_format="ttree") |
| | Write this split to disk as it would be loaded for training.
|
| |
| list[str] | target_columns (self) |
| | Target column names.
|
| |
| Tuple[RDataLoader, RDataLoader] | train_test_split (self, float test_size=0.2) |
| | Partition the dataset into training and validation splits.
|
| |
| str | weights_column (self) |
| | Weights column name, or empty string if not set.
|
| |