NeuralNetwork.evaluate#

usencrypt.ai.nn.NeuralNetwork.evaluate(self, X_test, y_test, batch_size=32, return_dict=False, metrics=None, save_file_path=None)#

Evaluates the neural network model with the given test set, returning the loss and performance metric results. Computation in batches is supported.

This function assumes the test data X_test is of shape (m, n), where m is the number of test examples and n is the number of features. Further, it also assumes the test labels y_test are represented by a one-hot encoded matrix of shape (m, c), where c is the number of classes.

Parameters
  • X_test (list or numpy.ndarray of float or usencrypt.cipher.Float) – The testing features.

  • y_test (list or numpy.ndarray of float or usencrypt.cipher.Float) – The testing labels.

  • batch_size (int) – The number of samples per batch. Defaults to 32.

  • return_dict (bool) – If True, it returns the results as a Python dictionary. If False, the results are returned as an array. Defaults to False.

  • metrics ({'accuracy'}) – A list of performance metrics to be used for evaluation. If None, only the overall loss is used. Defaults to None.

  • save_file_path (str) – Path for the resulting performance file. Defaults to None.

Returns

Either an array or dictionary containing the resulting performance metrics, as determined by the return_dict parameter.

Return type

numpy.ndarray or dict

Raises

TypeError – If the metrics parameter is not a list or numpy.ndarray.

Examples

For examples on how to work with the neural network model, please refer to our corresponding tutorials.