inverse_quadratic_rbf_expansion
Bases: gaussian_rbf_expansion
The inverse quadratic rbf data expansion function.
It performs the inverse quadratic rbf expansion of the input vector, and returns the expansion result. The class inherits from the base expansion class (i.e., the transformation class in the module directory).
...
Notes
For input vector \(\mathbf{x} \in R^m\), its inverse quadratic rbf expansion with \(d\) fixed points can be represented as follows: $$ \begin{equation} \kappa(\mathbf{x}) = {\varphi} (\mathbf{x} | \mathbf{c}) = \left[ \varphi (\mathbf{x} | c_1), \varphi (\mathbf{x} | c_2), \cdots, \varphi (\mathbf{x} | c_d) \right] \in {R}^D, \end{equation} $$ where the sub-vector element \({\varphi} (x | \mathbf{c})\) can be defined as follows: $$ \begin{equation} {\varphi} (x | \mathbf{c}) = \left[ \varphi (x | c_1), \varphi (x | c_2), \cdots, \varphi (x | c_d) \right] \in {R}^d. \end{equation} $$ and value \(\varphi (x | c)\) is defined as: $$ \begin{equation} \varphi (x | c) = \frac{1}{1 + (\epsilon (x - c))^2}. \end{equation} $$
For inverse quadratic rbf expansion, its output expansion dimensions will be \(D = md\).
By default, the input and output can also be processed with the optional pre- or post-processing functions in the inverse quadratic rbf expansion function.
Attributes:
Name | Type | Description |
---|---|---|
name |
str, default = 'inverse_quadratic_rbf_expansion'
|
Name of the expansion function. |
base_range |
tuple | list, default = (-1, 1)
|
Input value range. |
num_interval |
int, default = 10
|
Number of intervals of the input value range. |
epsilon |
float, default = 1.0
|
The rbf function parameter. |
base |
Tensor
|
The partition of value range into intervals, i.e., the vector \(\mathbf{c}\) in the above equation. |
Methods:
Name | Description |
---|---|
__init__ |
It performs the initialization of the expansion function. |
calculate_D |
It calculates the expansion space dimension D based on the input dimension parameter m. |
forward |
It implements the abstract forward method declared in the base expansion class. |
Source code in tinybig/expansion/rbf_expansion.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
|
__init__(name='inverse_quadratic_rbf', base_range=(-1, 1), num_interval=10, epsilon=1.0, base=None, *args, **kwargs)
The initialization method of the inverse quadratic rbf expansion function.
It initializes an inverse quadratic rbf expansion object based on the input function name. This method will also call the initialization method of the base class as well.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
The name of the inverse quadratic rbf expansion function. |
'inverse_quadratic_rbf'
|
|
base_range
|
Input value range. |
(-1, 1)
|
|
num_interval
|
Number of intervals partitioned by the fixed points. |
10
|
|
epsilon
|
The rbf function parameter. |
1.0
|
|
base
|
The partition of value range into intervals, i.e., the vector \(\mathbf{c}\) in the above equation. |
None
|
Returns:
Type | Description |
---|---|
transformation
|
The inverse quadratic rbf expansion object. |
Source code in tinybig/expansion/rbf_expansion.py
forward(x, device='cpu', *args, **kwargs)
The forward method of the data expansion function.
It performs the inverse quadratic rbf data expansion of the input data and returns the expansion result as $$ \begin{equation} \kappa(\mathbf{x}) = {\varphi} (\mathbf{x} | \mathbf{c}) = \left[ \varphi (\mathbf{x} | c_1), \varphi (\mathbf{x} | c_2), \cdots, \varphi (\mathbf{x} | c_d) \right] \in {R}^D, \end{equation} $$ where vector \(\mathbf{c}\) is the fixed point base tensor initialized above.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input data vector. |
required |
device
|
The device to perform the data expansion. |
'cpu'
|
Returns:
Type | Description |
---|---|
Tensor
|
The expanded data vector of the input. |