Ejemplo n.º 1
0
from sklearn.metrics import mean_squared_error
from keras.optimizers import Adam, RMSprop
from keras.utils import plot_model
from keras.callbacks import EarlyStopping, Callback, TensorBoard
from functions import PCA_compress, SVD_compress, SimpleDownsampling, overlapping, LossHistory, BatchTensorBoard, moving_average, load_file, normolization, dataprocessing_overlap, dataprocessing, get_ave_prediction, dataprocessing_stateful
# fix random seed for reproducibility
np.random.seed(7)
time_step = 1000
epoch = 300
batch_size = 100
LR = 0.005
average_num = 100
DownSample_num = 100
compress_num = 100

SensorTrain1, location1 = overlapping('1_timestep1000_overlap900.csv', 3,
                                      time_step)
SensorTrain2, location2 = overlapping('2_timestep1000_overlap900.csv', 3,
                                      time_step)
SensorTrain3, location3 = overlapping('3_timestep1000_overlap900.csv', 3,
                                      time_step)
SensorTrain4, location4 = overlapping('4_timestep1000_overlap900.csv', 3,
                                      time_step)
SensorTrain5, location5 = overlapping('5_timestep1000_overlap900.csv', 3,
                                      time_step)
SensorTrain6, location6 = overlapping('6_timestep1000_overlap900.csv', 3,
                                      time_step)
SensorTrain7, location7 = overlapping('7_timestep1000_overlap900.csv', 3,
                                      time_step)
SensorTrain8, location8 = overlapping('8_timestep1000_overlap900.csv', 3,
                                      time_step)
SensorTrain9, location9 = overlapping('9_timestep1000_overlap900.csv', 3,
Ejemplo n.º 2
0
#SensorTrainOL900_10_val, locationOL900_10_val = overlapping('10_timestep1000_overlap900.csv',3, time_step)
#SensorTrainOL900_11_val, locationOL900_11_val = overlapping('11_timestep1000_overlap900.csv',3, time_step)
#Sensor_OL900_val=np.concatenate((SensorTrainOL900_9_val,SensorTrainOL900_10_val,SensorTrainOL900_11_val),axis=0)
#loc_OL900_val=np.concatenate((locationOL900_9_val,locationOL900_10_val,locationOL900_11_val),axis=0)
#
#SensorTrainDS_9_val = SimpleDownsampling(SensorTrainOL900_9_val, downsample_num)
#SensorTrainDS_10_val = SimpleDownsampling(SensorTrainOL900_10_val, downsample_num)
#SensorTrainDS_11_val = SimpleDownsampling(SensorTrainOL900_11_val, downsample_num)

valpath = '11_timestep1000.csv'
Sensor_val, loc_val = dataprocessing(valpath, 3, time_step)

valpathOC300 = '11_timestep1000_overlap300.csv'
valpathOC500 = '11_timestep1000_overlap500.csv'
valpathOC900 = '11_timestep1000_overlap900.csv'
Sensor_OC300_val, loc_OC300_val = overlapping(valpathOC300, 3, time_step)
Sensor_OC500_val, loc_OC500_val = overlapping(valpathOC500, 3, time_step)
Sensor_OC900_val, loc_OC900_val = overlapping(valpathOC900, 3, time_step)

SensorTrainDS_val = SimpleDownsampling(Sensor_OC900_val, downsample_num)
SensorTrainPCA_100_val = PCA_compress(Sensor_OC900_val, 100)
SensorTrainPCA_10_val = PCA_compress(Sensor_OC900_val, 10)
SensorTrainSVD_100_val = SVD_compress(Sensor_OC900_val, 100)
SensorTrainSVD_10_val = SVD_compress(Sensor_OC900_val, 10)
#####################################################################validation

#####################################################################test
testpath = 'test_12_timestep1000.csv'

overlappath300 = '12_timestep1000_overlap300.csv'
overlappath500 = '12_timestep1000_overlap500.csv'