calpit.datasets
Classes
A custom dataset class to randomly select a data point. |
|
An abstract class representing a |
Module Contents
- class RandomDataset(x_data, y_data, oversample=1)[source]
Bases:
torch.utils.data.DatasetA custom dataset class to randomly select a data point. The data point is prepended with a random value between 0 and 1 from a Uniform distribution (coverage parameter). The target value is 0 if Y value is less than or equal to the coverage parameter and 1 otherwise. The data set can be oversampled by a given factor.
- Parameters:
X (list or array-like) – The input features.
Y (list or array-like) – The target values.
oversample (float, optional) – The oversampling factor. Defaults to 1.
- Returns:
A tuple containing the input feature and target value.
- Return type:
tuple
- class PhotometryDataset(file_path=None, pit=None, scaler=None)[source]
Bases:
torch.utils.data.DatasetAn abstract class representing a
Dataset.All datasets that represent a map from keys to data samples should subclass it. All subclasses should overwrite
__getitem__(), supporting fetching a data sample for a given key. Subclasses could also optionally overwrite__len__(), which is expected to return the size of the dataset by manySamplerimplementations and the default options ofDataLoader. Subclasses could also optionally implement__getitems__(), for speedup batched samples loading. This method accepts list of indices of samples of batch and returns list of samples.Note
DataLoaderby default constructs an index sampler that yields integral indices. To make it work with a map-style dataset with non-integral indices/keys, a custom sampler must be provided.