Variable Selection Network block
layer_vsn.Rd
It receives four-dimensional vector as an input in the case of dynamic data (batch_size, timesteps, n_features, feature_dim)
Usage
layer_vsn(
object,
hidden_units,
state_size,
dropout_rate = NULL,
use_context = FALSE,
return_weights = FALSE,
...
)
Arguments
- state_size
Dimensionality of the feature space, common across the model. The name comes from the original paper where they also refer to as $$d_model$$
- return_weights
Return weights of the selection.
Value
A tensor of shapes:
dynamic data - (batch_size, timesteps, state_size)
static data - (batch_size, state_size)
Examples
# =========================================================================
# THREE-DIMENSIONAL INPUT (STATIC FEATURES)
# =========================================================================
# input: (batch_size, n_features, state_size)
inp <- layer_input(c(10, 5))
out <- layer_vsn(hidden_units = 10, state_size = 5)(inp)
dim(out)
#> [1] NA 5
# =========================================================================
# FOUR-DIMENSIONAL INPUT (DYNAMIC FEATURES)
# =========================================================================
# input: (batch_size, timesteps, n_features, state_size)
inp <- layer_input(c(28, 10, 5))
out <- layer_vsn(hidden_units = 10, state_size = 5)(inp)
dim(out)
#> [1] NA 28 5