Type tf.estimator.inputs
Namespace tensorflow
Methods
Properties
Public static methods
object numpy_input_fn(IDictionary<string, object> x, ndarray y, int batch_size, Nullable<int> num_epochs, Nullable<bool> shuffle, int queue_capacity, int num_threads)
Returns input function that would feed dict of numpy arrays into the model. This returns a function outputting `features` and `targets` based on the dict
of numpy arrays. The dict `features` has the same keys as the `x`. The dict
`targets` has the same keys as the `y` if `y` is a dict. Example:
Parameters
-
IDictionary<string, object>
x - numpy array object or dict of numpy array objects. If an array, the array will be treated as a single feature.
-
ndarray
y - numpy array object or dict of numpy array object. `None` if absent.
-
int
batch_size - Integer, size of batches to return.
-
Nullable<int>
num_epochs - Integer, number of epochs to iterate over data. If `None` will run forever.
-
Nullable<bool>
shuffle - Boolean, if True shuffles the queue. Avoid shuffle at prediction time.
-
int
queue_capacity - Integer, size of queue to accumulate.
-
int
num_threads - Integer, number of threads used for reading and enqueueing. In order to have predicted and repeatable order of reading and enqueueing, such as in prediction and evaluation mode, `num_threads` should be 1.
Returns
-
object
- Function, that has signature of ()->(dict of `features`, `targets`)
Show Example
age = np.arange(4) * 1.0 height = np.arange(32, 36) x = {'age': age, 'height': height} y = np.arange(-32, -28) with tf.Session() as session: input_fn = numpy_io.numpy_input_fn( x, y, batch_size=2, shuffle=False, num_epochs=1)
object numpy_input_fn_dyn(object x, object y, ImplicitContainer<T> batch_size, ImplicitContainer<T> num_epochs, object shuffle, ImplicitContainer<T> queue_capacity, ImplicitContainer<T> num_threads)
Returns input function that would feed dict of numpy arrays into the model. This returns a function outputting `features` and `targets` based on the dict
of numpy arrays. The dict `features` has the same keys as the `x`. The dict
`targets` has the same keys as the `y` if `y` is a dict. Example:
Parameters
-
object
x - numpy array object or dict of numpy array objects. If an array, the array will be treated as a single feature.
-
object
y - numpy array object or dict of numpy array object. `None` if absent.
-
ImplicitContainer<T>
batch_size - Integer, size of batches to return.
-
ImplicitContainer<T>
num_epochs - Integer, number of epochs to iterate over data. If `None` will run forever.
-
object
shuffle - Boolean, if True shuffles the queue. Avoid shuffle at prediction time.
-
ImplicitContainer<T>
queue_capacity - Integer, size of queue to accumulate.
-
ImplicitContainer<T>
num_threads - Integer, number of threads used for reading and enqueueing. In order to have predicted and repeatable order of reading and enqueueing, such as in prediction and evaluation mode, `num_threads` should be 1.
Returns
-
object
- Function, that has signature of ()->(dict of `features`, `targets`)
Show Example
age = np.arange(4) * 1.0 height = np.arange(32, 36) x = {'age': age, 'height': height} y = np.arange(-32, -28) with tf.Session() as session: input_fn = numpy_io.numpy_input_fn( x, y, batch_size=2, shuffle=False, num_epochs=1)
object pandas_input_fn(object x, object y, int batch_size, Nullable<int> num_epochs, Nullable<bool> shuffle, int queue_capacity, int num_threads, IEnumerable<object> target_column)
Returns input function that would feed Pandas DataFrame into the model. Note: `y`'s index must match `x`'s index.
Parameters
-
object
x - pandas `DataFrame` object.
-
object
y - pandas `Series` object or `DataFrame`. `None` if absent.
-
int
batch_size - int, size of batches to return.
-
Nullable<int>
num_epochs - int, number of epochs to iterate over data. If not `None`, read attempts that would exceed this value will raise `OutOfRangeError`.
-
Nullable<bool>
shuffle - bool, whether to read the records in random order.
-
int
queue_capacity - int, size of the read queue. If `None`, it will be set roughly to the size of `x`.
-
int
num_threads - Integer, number of threads used for reading and enqueueing. In order to have predicted and repeatable order of reading and enqueueing, such as in prediction and evaluation mode, `num_threads` should be 1.
-
IEnumerable<object>
target_column - str, name to give the target column `y`. This parameter is not used when `y` is a `DataFrame`.
Returns
-
object
- Function, that has signature of ()->(dict of `features`, `target`)
object pandas_input_fn(object x, object y, int batch_size, Nullable<int> num_epochs, Nullable<bool> shuffle, int queue_capacity, int num_threads, string target_column)
Returns input function that would feed Pandas DataFrame into the model. Note: `y`'s index must match `x`'s index.
Parameters
-
object
x - pandas `DataFrame` object.
-
object
y - pandas `Series` object or `DataFrame`. `None` if absent.
-
int
batch_size - int, size of batches to return.
-
Nullable<int>
num_epochs - int, number of epochs to iterate over data. If not `None`, read attempts that would exceed this value will raise `OutOfRangeError`.
-
Nullable<bool>
shuffle - bool, whether to read the records in random order.
-
int
queue_capacity - int, size of the read queue. If `None`, it will be set roughly to the size of `x`.
-
int
num_threads - Integer, number of threads used for reading and enqueueing. In order to have predicted and repeatable order of reading and enqueueing, such as in prediction and evaluation mode, `num_threads` should be 1.
-
string
target_column - str, name to give the target column `y`. This parameter is not used when `y` is a `DataFrame`.
Returns
-
object
- Function, that has signature of ()->(dict of `features`, `target`)
object pandas_input_fn_dyn(object x, object y, ImplicitContainer<T> batch_size, ImplicitContainer<T> num_epochs, object shuffle, ImplicitContainer<T> queue_capacity, ImplicitContainer<T> num_threads, ImplicitContainer<T> target_column)
Returns input function that would feed Pandas DataFrame into the model. Note: `y`'s index must match `x`'s index.
Parameters
-
object
x - pandas `DataFrame` object.
-
object
y - pandas `Series` object or `DataFrame`. `None` if absent.
-
ImplicitContainer<T>
batch_size - int, size of batches to return.
-
ImplicitContainer<T>
num_epochs - int, number of epochs to iterate over data. If not `None`, read attempts that would exceed this value will raise `OutOfRangeError`.
-
object
shuffle - bool, whether to read the records in random order.
-
ImplicitContainer<T>
queue_capacity - int, size of the read queue. If `None`, it will be set roughly to the size of `x`.
-
ImplicitContainer<T>
num_threads - Integer, number of threads used for reading and enqueueing. In order to have predicted and repeatable order of reading and enqueueing, such as in prediction and evaluation mode, `num_threads` should be 1.
-
ImplicitContainer<T>
target_column - str, name to give the target column `y`. This parameter is not used when `y` is a `DataFrame`.
Returns
-
object
- Function, that has signature of ()->(dict of `features`, `target`)