MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / model_iteration

Function model_iteration

tensorflow/python/keras/engine/training_generator.py:41–349  ·  view source on GitHub ↗

Loop function for arrays of data with modes TRAIN/TEST/PREDICT. Arguments: model: Keras Model instance. data: Either a tuple of NumPy/Tensor inputs (i.e. `(x,)` or `(x, y)` or `(x, y, sample_weights)`) or a generator or `keras.utils.data_utils.Sequence` object or Eager

(model,
                    data,
                    steps_per_epoch=None,
                    epochs=1,
                    verbose=1,
                    callbacks=None,
                    validation_data=None,
                    validation_steps=None,
                    validation_freq=1,
                    class_weight=None,
                    max_queue_size=10,
                    workers=1,
                    use_multiprocessing=False,
                    shuffle=False,
                    initial_epoch=0,
                    mode=ModeKeys.TRAIN,
                    batch_size=None,
                    steps_name='steps',
                    **kwargs)

Source from the content-addressed store, hash-verified

39
40
41def model_iteration(model,
42 data,
43 steps_per_epoch=None,
44 epochs=1,
45 verbose=1,
46 callbacks=None,
47 validation_data=None,
48 validation_steps=None,
49 validation_freq=1,
50 class_weight=None,
51 max_queue_size=10,
52 workers=1,
53 use_multiprocessing=False,
54 shuffle=False,
55 initial_epoch=0,
56 mode=ModeKeys.TRAIN,
57 batch_size=None,
58 steps_name='steps',
59 **kwargs):
60 """Loop function for arrays of data with modes TRAIN/TEST/PREDICT.
61
62 Arguments:
63 model: Keras Model instance.
64 data: Either a tuple of NumPy/Tensor inputs (i.e. `(x,)` or `(x, y)` or
65 `(x, y, sample_weights)`) or a generator or
66 `keras.utils.data_utils.Sequence` object or Eager Iterator or Dataset.
67 steps_per_epoch: Total number of steps (batches of samples) before
68 declaring one epoch finished and starting the next epoch. Ignored with
69 the default value of `None`.
70 epochs: Number of times to iterate over the data.
71 verbose: 0, 1, or 2. Verbosity mode.
72 0 = silent, 1 = progress bar, 2 = one line per epoch.
73 Note that the progress bar is not particularly useful when
74 logged to a file, so verbose=2 is recommended when not running
75 interactively (eg, in a production environment).
76 callbacks: List of callbacks to be called during training.
77 validation_data: Either a tuple of NumPy/Tensor inputs (i.e. `(x,)` or
78 `(x, y)` or `(x, y, sample_weights)`) or a generator or
79 `keras.utils.data_utils.Sequence` object or Eager Iterator or Dataset.
80 validation_steps: Total number of steps (batches of samples) before
81 declaring validation finished.
82 validation_freq: Only relevant if validation data is provided. Integer or
83 `collections.abc.Container` instance (e.g. list, tuple, etc.). If an
84 integer, specifies how many training epochs to run before a new
85 validation run is performed, e.g. `validation_freq=2` runs
86 validation every 2 epochs. If a Container, specifies the epochs on
87 which to run validation, e.g. `validation_freq=[1, 2, 10]` runs
88 validation at the end of the 1st, 2nd, and 10th epochs.
89 class_weight: Dictionary mapping class indices to a weight for the class.
90 max_queue_size: Integer. Maximum size for the generator queue. If
91 unspecified, `max_queue_size` will default to 10.
92 workers: Integer. Maximum number of processes to spin up when using
93 process-based threading. If unspecified, `workers` will default to 1. If
94 0, will execute the generator on the main thread.
95 use_multiprocessing: Boolean. If `True`, use process-based threading. If
96 unspecified, `use_multiprocessing` will default to `False`. Note that
97 because this implementation relies on multiprocessing, you should not
98 pass non-picklable arguments to the generator as they can't be passed

Callers

nothing calls this directly

Calls 15

createMethod · 0.95
aggregateMethod · 0.95
finalizeMethod · 0.95
_make_enqueued_generatorFunction · 0.85
_get_next_batchFunction · 0.85
batch_functionFunction · 0.85
executing_eagerlyMethod · 0.80
_call_begin_hookMethod · 0.80
reset_metricsMethod · 0.80
_call_batch_hookMethod · 0.80

Tested by

no test coverage detected