Advanced Data Analytics Using Python_ With Machine Learning, Deep Learning and NLP Examples ( 2023)
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Chapter 5
Deep Learning and Neural Networks
cost = sess.run(cost_function,
feed_dict={x_t: X_train.reshape
(X_train.shape[0],X_train.
shape[1]), y_t: y_train.reshape
(y_train.shape[0],1)})
else:
sess.run(optimizer, feed_
dict={x_t_user: X_train_
user.reshape(X_train_user.
shape[0],X_train_user.shape[1]),
x_t_context: X_train_context.
reshape(X_train_context.
shape[0],X_train_context.
shape[1]), y_t: y_train.
reshape(y_train.shape[0],1)})
cost = sess.run(cost_function,
feed_dict={x_t_user: X_train_user.
reshape(X_train_user.shape[0],X_
train_user.shape[1]), x_t_context:
X_train_context.reshape(X_train_
context.shape[0],X_train_context.
shape[1]), y_t: y_train.reshape(y_
train.shape[0],1)})
if step%1000 == 0:
print(cost)
if previous == cost or step > 50000:
break
if cost != cost :
raise Exception("NaN value")
previous = cost
110