Commit 4a17904e authored by Avisek Naug's avatar Avisek Naug 🎨
Browse files

File for cluster training

parent 698a6bc7
# import modules
from helperfunctions import *
from dataGenerator import *
from PredictionModel import *
period = 12 # ie period*5 minutes eg 12*5 60 minutes
# Remove add previous Results Plot + Log Plot
import os
try:
os.mkdir('ResultsPlot')
except FileExistsError:
pass
try:
os.mkdir('loginfo')
except FileExistsError:
pass
# Remove model training log file infos
files = os.listdir('loginfo/')
for f in files:
os.remove('loginfo/' + f)
# Create train and test data
datapath = '1Hourdata.pkl'
trains_X,trains_y,tests_X,tests_y = datageneration(datapath, period=period, lag=-1,
inputfeatures = 5, outputfeatures=1)
# LSTM model
"""
Since this SLTM model is stateful remember to make a batch size of 1 only
"""
model = LSTMmodel(batch_size=1)
model.trainmodel(trains_X,trains_y,tests_X,tests_y,noepochs=1)
# Log error metrics
model.logError(trains_X,trains_y,tests_X,tests_y)
# Save Plots
model.generatePlots(trains_y,tests_y)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment