mirror of
https://github.com/webclinic017/drift.git
synced 2026-08-03 22:27:47 +00:00
feat(Model): now successfully training the basic LSTM model
This commit is contained in:
+1
-1
@@ -3,4 +3,4 @@ import pandas as pd
|
||||
def normalize(data: pd.DataFrame) -> pd.DataFrame:
|
||||
data_mean = data.mean(axis=0)
|
||||
data_std = data.std(axis=0)
|
||||
return (data - data_mean) / data_std
|
||||
return ((data - data_mean) / data_std).fillna(0.)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
|
||||
def visualize_loss(history, title: str):
|
||||
loss = history.history["loss"]
|
||||
val_loss = history.history["val_loss"]
|
||||
epochs = range(len(loss))
|
||||
plt.figure()
|
||||
plt.plot(epochs, loss, "b", label="Training loss")
|
||||
plt.plot(epochs, val_loss, "r", label="Validation loss")
|
||||
plt.title(title)
|
||||
plt.xlabel("Epochs")
|
||||
plt.ylabel("Loss")
|
||||
plt.legend()
|
||||
plt.show()
|
||||
Reference in New Issue
Block a user