Created
April 8, 2018 04:59
-
-
Save rish-16/ef484f21e4239f28817cbfcf072b2872 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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