09.10.2023 Views

Advanced Data Analytics Using Python_ With Machine Learning, Deep Learning and NLP Examples ( 2023)

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 5

Deep Learning and Neural Networks

except Exception as e:

print (str(e))

print ('Training duration (s) : ', time.time() - global_

start_time)

return model, y_test, predicted

if __name__ == '__main__':

path_to_dataset = '20170301_ltp.csv'

data = read_data(path_to_dataset)

error = []

diff_predicted = []

err_predicted = []

print len(data)

for i in range(0,len(data)-1000,89):

d = data[i:i+1000]

model, y_test, predicted = run_network(None,d, False)

if i > 11 and len(error) >= 1000:

model,err_test, err_predicted =

run_network(None,error, True)

error = error[90:]

d1 = data[i:i+1001]

diff = [0]*1000

for k in range(1000):

diff[k] = d1[k+1] - d1[k]

model,diff_test, diff_predicted =

run_network(None,diff, True)

print i,len(d), len(y_test)

y_test *= result_std

predicted *= result_std

y_test += result_mean

predicted += result_mean

118

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!