Method: DNN::Models::Model#evaluate

Defined in:
lib/dnn/core/models.rb

#evaluate(x, y, batch_size: 100, accuracy: true) ⇒ Array

Evaluate model and get accuracy and loss of test data.

Parameters:

  • x (Numo::SFloat)

    Input test data.

  • y (Numo::SFloat)

    Output test data.

  • batch_size (Integer) (defaults to: 100)

    Batch size used for one test.

Returns:

  • (Array)

    Returns the test data accuracy and mean loss in the form [accuracy, mean_loss]. If accuracy is not needed returns in the form [nil, mean_loss].



330
331
332
333
# File 'lib/dnn/core/models.rb', line 330

def evaluate(x, y, batch_size: 100, accuracy: true)
  check_xy_type(x, y)
  evaluate_by_iterator(Iterator.new(x, y, random: false), batch_size: batch_size, accuracy: accuracy)
end