dataset
Bases: Dataset
The dataset base class.
It defines the template of the dataset, composed of X, y and optional encoder of the features.
Attributes:
Name | Type | Description |
---|---|---|
X |
Any
|
The inputs/features of the data instances in the batch. |
y |
Any
|
The outputs/labels of the data instances in the batch. |
encoder |
Any, default = None
|
The optional encoder, which can be used for text dataset to project text to the embeddings. |
Methods:
Name | Description |
---|---|
__init__ |
The dataset initialization method. |
__len__ |
The size method of the input data batch. |
__getitem__ |
The item retrieval method of the input data batch with certain index. |
Source code in tinybig/data/base_data.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
__getitem__(idx, *args, **kwargs)
The item retrieval method.
It returns the feature and label of data instances with certain index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
idx |
The index of the data instance to be retrieved. |
required |
Returns:
Type | Description |
---|---|
tuple
|
The retrieved feature and label of the data instance. |
Source code in tinybig/data/base_data.py
__init__(X, y, encoder=None, *args, **kwargs)
The initialization method of the base dataset class.
It initializes the dataset class object, involving the input features X, output labels y and the optional encoder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X |
The inputs/features of the data instances in the batch. |
required | |
y |
The outputs/labels of the data instances in the batch. |
required | |
encoder |
The optional encoder, which can be used for text dataset to project text to the embeddings. |
None
|
Returns:
Type | Description |
---|---|
object
|
The initialized object of the base dataset. |
Source code in tinybig/data/base_data.py
__len__()
The batch size method.
It reimplements the built-in batch size method.
Returns:
Type | Description |
---|---|
int
|
The batch size of the input data instance set. |