tf.contrib.learn.Trainable
Stay organized with collections
Save and categorize content based on your preferences.
Interface for objects that are trainable by, e.g., Experiment
.
THIS CLASS IS DEPRECATED.
Methods
fit
View source
@abc.abstractmethod
fit(
x=None, y=None, input_fn=None, steps=None, batch_size=None, monitors=None,
max_steps=None
)
Trains a model given training data x
predictions and y
labels.
Args |
x
|
Matrix of shape [n_samples, n_features...] or the dictionary of
Matrices.
Can be iterator that returns arrays of features or dictionary of arrays
of features.
The training input samples for fitting the model. If set, input_fn
must be None .
|
y
|
Vector or matrix [n_samples] or [n_samples, n_outputs] or the
dictionary of same.
Can be iterator that returns array of labels or dictionary of array of
labels.
The training label values (class labels in classification, real numbers
in regression).
If set, input_fn must be None . Note: For classification, label
values must
be integers representing the class index (i.e. values from 0 to
n_classes-1).
|
input_fn
|
Input function returning a tuple of:
features - Tensor or dictionary of string feature name to Tensor .
labels - Tensor or dictionary of Tensor with labels.
If input_fn is set, x , y , and batch_size must be None .
|
steps
|
Number of steps for which to train model. If None , train forever.
'steps' works incrementally. If you call two times fit(steps=10) then
training occurs in total 20 steps. If you don't want to have incremental
behavior please set max_steps instead. If set, max_steps must be
None .
|
batch_size
|
minibatch size to use on the input, defaults to first
dimension of x . Must be None if input_fn is provided.
|
monitors
|
List of BaseMonitor subclass instances. Used for callbacks
inside the training loop.
|
max_steps
|
Number of total steps for which to train model. If None ,
train forever. If set, steps must be None .
Two calls to fit(steps=100) means 200 training
iterations. On the other hand, two calls to fit(max_steps=100) means
that the second call will not do any iteration since first call did
all 100 steps.
|
Returns |
self , for chaining.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.contrib.learn.Trainable\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/learn/python/learn/trainable.py#L32-L90) |\n\nInterface for objects that are trainable by, e.g., `Experiment`.\n\nTHIS CLASS IS DEPRECATED.\n\nMethods\n-------\n\n### `fit`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/learn/python/learn/trainable.py#L38-L90) \n\n @abc.abstractmethod\n fit(\n x=None, y=None, input_fn=None, steps=None, batch_size=None, monitors=None,\n max_steps=None\n )\n\nTrains a model given training data `x` predictions and `y` labels.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `x` | Matrix of shape \\[n_samples, n_features...\\] or the dictionary of Matrices. Can be iterator that returns arrays of features or dictionary of arrays of features. The training input samples for fitting the model. If set, `input_fn` must be `None`. |\n| `y` | Vector or matrix \\[n_samples\\] or \\[n_samples, n_outputs\\] or the dictionary of same. Can be iterator that returns array of labels or dictionary of array of labels. The training label values (class labels in classification, real numbers in regression). If set, `input_fn` must be `None`. Note: For classification, label values must be integers representing the class index (i.e. values from 0 to n_classes-1). |\n| `input_fn` | Input function returning a tuple of: features - `Tensor` or dictionary of string feature name to `Tensor`. labels - `Tensor` or dictionary of `Tensor` with labels. If input_fn is set, `x`, `y`, and `batch_size` must be `None`. |\n| `steps` | Number of steps for which to train model. If `None`, train forever. 'steps' works incrementally. If you call two times fit(steps=10) then training occurs in total 20 steps. If you don't want to have incremental behavior please set `max_steps` instead. If set, `max_steps` must be `None`. |\n| `batch_size` | minibatch size to use on the input, defaults to first dimension of `x`. Must be `None` if `input_fn` is provided. |\n| `monitors` | List of `BaseMonitor` subclass instances. Used for callbacks inside the training loop. |\n| `max_steps` | Number of total steps for which to train model. If `None`, train forever. If set, `steps` must be `None`. \u003cbr /\u003e Two calls to `fit(steps=100)` means 200 training iterations. On the other hand, two calls to `fit(max_steps=100)` means that the second call will not do any iteration since first call did all 100 steps. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| `self`, for chaining. ||\n\n\u003cbr /\u003e"]]