jeffheaton / t81_558_deep_learning

T81-558: Keras - Applications of Deep Neural Networks @Washington University in St. Louis
https://sites.wustl.edu/jeffheaton/t81-558/
Other
5.71k stars 3.04k forks source link

typo found in `t81_558_class_14_03_anomaly.ipynb` #51

Closed alik604 closed 4 years ago

alik604 commented 4 years ago

First of all thank you for posting notebooks. It's nice concise way for me to test out a new concept :)

The notebook t81_558_class_14_03_anomaly.ipynb has typos in the last cell

score1 = np.sqrt(metrics.mean_squared_error(pred,x_normal_test))
print(f"Insample Normal Score (RMSE): {score1}".format(score1))
# score is the test set
# score2 is the whole dataset (- attacks) 

Only the 2nd and 3rd to last print statements need to be changed

jeffheaton commented 4 years ago

You are basically saying the out of sample/in-sample prints were flipped? I made that adjustment and also got rid of the stray .format(score1).

alik604 commented 4 years ago

I recall they being two typos, I saw only one now

df_normal = df[normal_mask]
x_normal = df_normal.values

x_normal_train, x_normal_test = train_test_split(x_normal, test_size=0.25, random_state=42)

pred = model.predict(x_normal)
score2 = np.sqrt(metrics.mean_squared_error(pred,x_normal))
print(f"Insample Normal Score (RMSE): {score2}")

Regarding the last line, to my understanding, Insample implies it being from the training set. However, this appears to be all (normal) date

Sorry if I'm mistaken. Please feel free to close the request when ever you wish

jeffheaton commented 4 years ago

Added more description. Training occurred entirely on normal data so the insample and out of sample both come from just normals. The final RMSE reports the error on the non-normal, which is higher, indicating an anomoly.