Skip to content

Instantly share code, notes, and snippets.

@rish-16
Created April 8, 2018 04:59
Show Gist options
  • Save rish-16/ef484f21e4239f28817cbfcf072b2872 to your computer and use it in GitHub Desktop.
Save rish-16/ef484f21e4239f28817cbfcf072b2872 to your computer and use it in GitHub Desktop.
import tflearn
import numpy as np
x = np.array([[1], [2], [3], [4], [5], [6], [7]], dtype=np.float32)
y = np.array([[1], [3], [5], [7], [9], [11], [13]], dtype=np.float32)
n = tflearn.input_data(shape=[None, 1])
n = tflearn.fully_connected(n, 1, activation='softmax')
n = tflearn.regression(n, optimizer=tflearn.SGD(), loss='categorical_crossentropy')
model = tflearn.DNN(n)
model.fit(x, y, n_epoch=1000, show_metric=True)
pred = model.predict(np.array([[8]]))
print (pred)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment