Keras中model.evaluate()返回的是 loss value & metrics values

Keras官方文档: https://keras.io/models/model/#evaluate

 

Keras中model.evaluate()返回的是 损失值你选定的指标值(例如,精度accuracy)。

 

evaluate

evaluate(x=None, y=None, batch_size=None, verbose=1, sample_weight=None, steps=None)

Returns the loss value & metrics values for the model in test mode.

Computation is done in batches.

Arguments

  • x: Numpy array of test data (if the model has a single input), or list of Numpy arrays (if the model has multiple inputs). If input layers in the model are named, you can also pass a dictionary mapping input names to Numpy arrays. x can be None (default) if feeding from framework-native tensors (e.g. TensorFlow data tensors).
  • y: Numpy array of target (label) data (if the model has a single output), or list of Numpy arrays (if the model has multiple outputs). If output layers in the model are named, you can also pass a dictionary mapping output names to Numpy arrays. y can be None (default) if feeding from framework-native tensors (e.g. TensorFlow data tensors).
  • batch_size: Integer or None. Number of samples per evaluation step. If unspecified, batch_sizewill default to 32.
  • verbose: 0 or 1. Verbosity mode. 0 = silent, 1 = progress bar.
  • sample_weight: Optional Numpy array of weights for the test samples, used for weighting the loss function. You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specifysample_weight_mode="temporal" in compile().
  • steps: Integer or None. Total number of steps (batches of samples) before declaring the evaluation round finished. Ignored with the default value of None.

Returns

Scalar test loss (if the model has a single output and no metrics) or list of scalars (if the model has multiple outputs and/or metrics). The attribute model.metrics_names will give you the display labels for the scalar outputs.

你可能感兴趣的:(深度学习)