make_embedding: Create the embedding for a dataset.

View source: R/entity_embedding.R

make_embeddingR Documentation

Create the embedding for a dataset.

Description

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

Usage

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)

mlr-org/mlr3keras documentation built on April 12, 2022, 11:35 a.m.