ml/as2_Maggioni_Claudio/src/t_test_bonus.py

23 lines
617 B
Python

import joblib
import numpy as np
from keras import models
import scipy.stats
# Import the accuracy of both models
e_a = 0.856333315372467 # without augmentation
e_b = 0.843666672706604 # with data augmentation
# # of data points in both test sets
L = 3000
# Compute classification variance for both models
s_a = e_a * (1 - e_a)
s_b = e_b * (1 - e_b)
# Compute Student's T-test
T = (e_a - e_b) / np.sqrt((s_a / L) + (s_b / L))
print("T test:\t\t\t %1.06f" % T)
print("P-value:\t\t %1.06f" % (scipy.stats.t.sf(abs(T), df=L) * 2))
print("No aug variance:\t %1.06f" % s_a)
print("With aug variance:\t %1.06f" % s_b)