combinatorial_normal_expansion
Bases: combinatorial_expansion
The combinatorial normal data expansion function.
It performs the combinatorial normal probabilistic 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 combinatorial normal probabilistic expansion can be represented as follows: $$ \begin{equation} kappa(\mathbf{x} | \boldsymbol{\theta}) = \left[ \log P\left({\mathbf{x} \choose 1} | \theta_1\right), \log P\left({\mathbf{x} \choose 2} | \theta_2\right), \cdots, \log P\left({\mathbf{x} \choose d} | \theta_d\right) \right] \in {R}^D \end{equation} $$ where term \(P\left({{x}} | \theta_d\right)\) in the above expansion denotes the probability density function of the multivariate normal distribution with hyper-parameter \(\theta_d\), $$ \begin{equation} P\left(x | \theta_d\right) \sim \mathcal{N}(\boldsymbol{\mu}, \boldsymbol{\Sigma}), \end{equation} $$ where the hyper-parameter \(\theta_d = (\mathbf{\mu}, \mathbf{\Sigma})\) covers the mean vector \(\mathbf{\mu}\) and variance matrix \(\mathbf{\Sigma}\).
For combinatorial normal probabilistic expansion, its output expansion dimensions will be \(D = \sum_{i=1}^d {m \choose i}\), where \(d\) denotes the combinatorial expansion order parameter.
By default, the input and output can also be processed with the optional pre- or post-processing functions in the gaussian rbf expansion function.
Attributes:
Name | Type | Description |
---|---|---|
name |
str, default = 'combinatorial_normal_expansion'
|
The name of the combinatorial normal expansion function. |
d |
int, default = 2
|
The combinatorial expansion order. |
with_replacement |
bool, default = False
|
The with_replacement tag for the random combination. |
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/combinatorial_expansion.py
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 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
|
__init__(name='combinatorial_normal_expansion', d=1, with_replacement=False, *args, **kwargs)
The initialization method of the combinatorial normal probabilistic expansion function.
It initializes a combinatorial normal probabilistic 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
|
str
|
The name of the combinatorial normal probabilistic expansion function. |
'combinatorial_normal_expansion'
|
d
|
int
|
The order of random combinations. |
1
|
with_replacement
|
bool
|
The replacement boolean tag. |
False
|
Returns:
Type | Description |
---|---|
transformation
|
The combinatorial normal probabilistic expansion function. |
Source code in tinybig/expansion/combinatorial_expansion.py
calculate_D(m)
The expansion dimension calculation method.
It calculates the intermediate expansion space dimension based on the input dimension parameter m. For the combinatorial expansion function, the expansion space dimension will be $$ D = \sum_{i=1}^d {m \choose i}. $$
Parameters:
Name | Type | Description | Default |
---|---|---|---|
m
|
int
|
The dimension of the input space. |
required |
Returns:
Type | Description |
---|---|
int
|
The dimension of the expansion space. |
Source code in tinybig/expansion/combinatorial_expansion.py
forward(x, device='cpu', with_replacement=False, *args, **kwargs)
The forward method of the combinatorial normal probabilistic expansion function.
It performs the combinatorial data expansion of the input data and returns the expansion result as $$ \begin{equation} \kappa(\mathbf{x}) = \left[ {\mathbf{x} \choose 1}, {\mathbf{x} \choose 2}, \cdots, {\mathbf{x} \choose d} \right] \in {R}^D. \end{equation} $$
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
The input data vector. |
required |
device
|
The device to perform the data expansion. |
'cpu'
|
|
with_replacement
|
bool
|
The replacement boolean tag. |
False
|
Returns:
Type | Description |
---|---|
Tensor
|
The expanded data vector of the input. |