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
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 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|
__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. |