From 4e99c559570e20e1193505ac3a8bec0adb5e49da Mon Sep 17 00:00:00 2001 From: Austin Swinney Date: Mon, 28 Oct 2024 12:38:19 -0400 Subject: [PATCH] playing with a test case. --- AI/TensorFlow/Example1/test_tf_mnist.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 AI/TensorFlow/Example1/test_tf_mnist.py diff --git a/AI/TensorFlow/Example1/test_tf_mnist.py b/AI/TensorFlow/Example1/test_tf_mnist.py new file mode 100644 index 00000000..b47c67dd --- /dev/null +++ b/AI/TensorFlow/Example1/test_tf_mnist.py @@ -0,0 +1,19 @@ +import pytest +import tensorflow as tf +import numpy as np +from tf_mnist import model, x_test, y_test, ROC_curves + +def test_model_evaluation(): + score = model.evaluate(x_test, y_test, verbose=0) + assert score[1] > 0.90, "Accuracy should be higher than 90%" + +def test_predictions(): + predictions = model.predict(x_test) + assert predictions.shape[0] == len(x_test), "Prediction shape mismatch" + +def test_ROC_curves(): + predictions = model.predict(x_test) + FPR, TPR, AUC = ROC_curves(y_test, predictions, 10) + assert len(FPR) == 10, "FPR length mismatch" + assert len(TPR) == 10, "TPR length mismatch" + assert len(AUC) == 10, "AUC length mismatch" \ No newline at end of file