Multi-Layer Perceptron Networks in Theano and TensorFlow: An Implementation and Benchmark

A past blog post explored using multi-layer-perceptrons (MLP) to predict stock prices using Tensorflow and Python. This post introduces another common library used for artificial neural networks (ANN) and other numerical purposes: Theano. An MLP Python class is created implemented using Theano, and then the performance of the class is compared with the TFANN class in a benchmark.

Continue reading “Multi-Layer Perceptron Networks in Theano and TensorFlow: An Implementation and Benchmark”


Stock Market Prediction Using Multi-Layer Perceptrons With TensorFlow

This post is part of a series on artificial neural networks (ANN) in TensorFlow and Python.

  1. Stock Market Prediction Using Multi-Layer Perceptrons With TensorFlow
  2. Stock Market Prediction in Python Part 2
  3. Visualizing Neural Network Performance on High-Dimensional Data
  4. Image Classification Using Convolutional Neural Networks in TensorFlow

In this post a multi-layer perceptron (MLP) class based on the TensorFlow library is discussed. The class is then applied to the problem of performing stock prediction given historical data. Note: This post is not meant to characterize how stock prediction is actually done; it is intended to demonstrate the TensorFlow library and MLPs.

Data Setup

The data used in this post was collected from The data consists of historical stock data from Yahoo Inc. over the period of the 12th of April 1996 to the 19th of April 2016. The data can be downloaded as a CSV file from the provided link. Note: YHOO is no longer traded as the company’s name has changed; feel free to use the provided link or historical data from another company.

To pre-process the data for the neural network, first transform the dates into integer values using LibreOffice’s DATEVALUE function. A screen-shot of the transformed data can be seen as follows:

Continue reading “Stock Market Prediction Using Multi-Layer Perceptrons With TensorFlow”