layer_input_from_dataset: Creates a list of inputs from a dataset

Description Usage Arguments Value Examples

View source: R/feature_spec.R

Description

Create a list ok Keras input layers that can be used together with keras::layer_dense_features().

Usage

1

Arguments

dataset

a TensorFlow dataset or a data.frame

Value

a list of Keras input layers

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
library(tfdatasets)
data(hearts)
hearts <- tensor_slices_dataset(hearts) %>% dataset_batch(32)

# use the formula interface
spec <- feature_spec(hearts, target ~ age + slope) %>%
  step_numeric_column(age, slope) %>%
  step_bucketized_column(age, boundaries = c(10, 20, 30))

spec <- fit(spec)
dataset <- hearts %>% dataset_use_spec(spec)

input <- layer_input_from_dataset(dataset)

## End(Not run)

tfdatasets documentation built on Nov. 10, 2021, 1:07 a.m.