Wednesday, April 26, 2017

AI: Deep Learning in 7 lines of code

Deep Learning in 7 lines of code – Chatbot’s Life

"The essence of machine learning is recognizing patterns within data. This boils down to 3 things: data, software and math. What can be done in seven lines of code you ask? A lot."


"TFLearn: Deep learning library featuring a higher-level API for (Google's) TensorFlow."

# Build neural network
net = tflearn.input_data(shape=[None, 5])
net = tflearn.fully_connected(net, 32)
net = tflearn.fully_connected(net, 32)
net = tflearn.fully_connected(net, 2, activation='softmax')
net = tflearn.regression(net)

# Define model and setup tensorboard
model = tflearn.DNN(net, tensorboard_dir='tflearn_logs')
# Start training (apply gradient descent algorithm)
model.fit(train_x, train_y, n_epoch=500, batch_size=16, show_metric=True)



No comments: