Description Usage Arguments Details See Also Examples
This function constructs input function from various types of input used to feed different TensorFlow estimators.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | input_fn(object, ...)
## Default S3 method:
input_fn(object, ...)
## S3 method for class 'formula'
input_fn(object, data, ...)
## S3 method for class 'data.frame'
input_fn(
object,
features,
response = NULL,
batch_size = 128,
shuffle = "auto",
num_epochs = 1,
queue_capacity = 1000,
num_threads = 1,
...
)
## S3 method for class 'list'
input_fn(
object,
features,
response = NULL,
batch_size = 128,
shuffle = "auto",
num_epochs = 1,
queue_capacity = 1000,
num_threads = 1,
...
)
## S3 method for class 'matrix'
input_fn(object, ...)
|
object, data |
An 'input source' – either a data set (e.g. an R |
... |
Optional arguments passed on to implementing submethods. |
features |
The names of feature variables to be used. |
response |
The name of the response variable. |
batch_size |
The batch size. |
shuffle |
Whether to shuffle the queue. When |
num_epochs |
The number of epochs to iterate over data. |
queue_capacity |
The size of queue to accumulate. |
num_threads |
The number of threads used for reading and enqueueing. In
order to have predictable and repeatable order of reading and enqueueing,
such as in prediction and evaluation mode, |
For list objects, this method is particularly useful when constructing dynamic length of inputs for models like recurrent neural networks. Note that some arguments are not available yet for input_fn applied to list objects. See S3 method signatures below for more details.
Other input functions:
numpy_input_fn()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ## Not run:
# Construct the input function through formula interface
input_fn1 <- input_fn(mpg ~ drat + cyl, mtcars)
## End(Not run)
## Not run:
# Construct the input function from a data.frame object
input_fn1 <- input_fn(mtcars, response = mpg, features = c(drat, cyl))
## End(Not run)
## Not run:
# Construct the input function from a list object
input_fn1 <- input_fn(
object = list(
feature1 = list(
list(list(1), list(2), list(3)),
list(list(4), list(5), list(6))),
feature2 = list(
list(list(7), list(8), list(9)),
list(list(10), list(11), list(12))),
response = list(
list(1, 2, 3), list(4, 5, 6))),
features = c("feature1", "feature2"),
response = "response",
batch_size = 10L)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.