99import matplotlib .pyplot as plt
1010
1111# definitions
12- FILE_NAME = "newdata0725_variable_interval .csv"
12+ FILE_NAME = "newdata .csv"
1313# FILE_NAME = "test.csv"
1414TIME_INTERVAL = 10 # records per second
1515
2121
2222LEARNING_RATE = 0.003
2323STANDARD_DEVIATION = 0.1
24- TRAINING_EPOCHS = 1000
24+ TRAINING_EPOCHS = 10
2525BATCH_SIZE = 50 # 100
2626DISPLAY_STEP = 20
2727RANDOM_STATE = 100
@@ -47,6 +47,12 @@ def find_second_beg(data_set, start_second):
4747 return start_idx
4848
4949
50+ def outputSpecialData (arr , val ):
51+ for i in range (len (arr )):
52+ if arr [i ] > val or arr [i ] < - val :
53+ print ("" + i + arr [i ])
54+
55+
5056# fetch data from csv file
5157# data format:
5258# [0]: time
@@ -62,7 +68,7 @@ def find_second_beg(data_set, start_second):
6268raw_linear_heave = np .array (raw_data [:, 2 ])
6369raw_real_heave = np .array (raw_data [:, 3 ])
6470raw_nonlinear_heave = np .subtract (raw_real_heave , raw_linear_heave )
65- print (raw_nonlinear_heave [ 0 ] )
71+ # outputSpecialData (raw_nonlinear_heave, 1 )
6672
6773print (raw_data [find_second_beg (raw_data , 101 )])
6874print (raw_data [find_second_beg (raw_data , 120 )])
@@ -76,6 +82,7 @@ def find_second_beg(data_set, start_second):
7682 training_target [i ] = [raw_nonlinear_heave [training_data_idx_start + i ]]
7783training_input = np .array (training_input )
7884training_target = np .array (training_target )
85+ # outputSpecialData(training_target, 1)
7986print (training_input .shape )
8087print (training_target .shape )
8188
@@ -87,9 +94,11 @@ def find_second_beg(data_set, start_second):
8794 testing_target [i ] = [raw_nonlinear_heave [testing_data_idx_start + i ]]
8895testing_input = np .array (testing_input )
8996testing_target = np .array (testing_target )
97+ # outputSpecialData(testing_target, 1)
9098print (testing_input .shape )
9199print (testing_target .shape )
92100
101+
93102# NRMSE
94103def nrmse (real , predict ):
95104 up = tf .sqrt (tf .reduce_sum (tf .square (real - predict )))
@@ -218,6 +227,7 @@ def mlp(_x, _weights, _biases):
218227# Testing
219228test_acc = sess .run (pred , feed_dict = {X : testing_input , y : testing_target , dropout_keep_prob : 1. })
220229# print("Test accuracy: %.6f" % test_acc)
230+ outputSpecialData (testing_target , 1 )
221231print (repr (np .column_stack ((test_acc , testing_target ))))
222232# for i in np.column_stack((test_acc, testing_target)):
223233# print(repr(i))
0 commit comments