Creates an input for each categorical var, concatenates those, Adds batch-norm to continuous vars etc.

make_embedding(task, embed_size = NULL, embed_dropout = 0)

Arguments

task

Task
An mlr3 Task.

embed_size

numeric
A numeric, either a single number determining the embedding size for all categorical features, a named vector, determining the embedding the size for each feature individually or NULL: Use a heuristic. The heuristic is round(1.6 * n_cat^0.56) where n_cat is the number of levels.

embed_dropout

numeric
Dropout fraction for the embedding layer.

Value

A list of input tensors and layer: the concatenated embeddings.

References

Guo, Berkhan, 2016 Entity Embeddings of Categorical Variables

Examples

task = mlr3::mlr_tasks$get("boston_housing") make_embedding(task)
#> $inputs #> $inputs[[1]] #> Tensor("chas:0", shape=(None, 1), dtype=int32) #> #> $inputs[[2]] #> Tensor("town:0", shape=(None, 1), dtype=int32) #> #> $inputs$cont #> Tensor("continuous:0", shape=(None, 16), dtype=float32) #> #> #> $layers #> Tensor("concatenate/concat:0", shape=(None, 38), dtype=float32) #>