with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
for epoca in range(10000):
erro_medio = 0.0
batch_total = int(len(X_treinamento) / batch_size)
X_batches = np.array_split(X_treinamento, batch_total)
y_batches = np.array_split(y_treinamento, batch_total)
for i in range(batch_total):
X_batch, y_batch = X_batches[i], y_batches[i]
_, custo = sess.run([otimizador, erro], feed_dict = {xph: X_batch, yph: y_batch})
erro_medio += custo / batch_total
if epoca % 500 == 0:
print('Ehpoc: ' + str((Ehpoc+ 1)) + ' erro: ' + str(erro_medio))
W_final, b_final = sess.run([W, b])