Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

BUSINES INTELLIGENCE & ANALYTICS

(MS6840)

Artificial Neural Networks (ANN) for


financial time series modeling

Saji K Mathew, PhD


Professor, Department of Management Studies
INDIAN INSTITUTE OF TECHNOLOGY MADRAS
AI: Winter to Spring
} Google’s search
} Facebook—automatic
photo tagging
} Apple’s voice assistant
} Amazon recommendations
} Tesla’s self driving cars
Machinery question
Cognitive neuroscience
} Deals with mental abilities and brain functioning
} Invention of microscope and neurons thereafter
} Neurons as fundamental elements for brain’s information
processing
} Neuron-neuron communication through release of
neurotransmitters (chemicals) into junctions between
neurons (synapse)
} An average brain has ~100bn neurons, each one
connected to 15,000 other neurons
} When one neuron fires another, it becomes a Hebbian
circuit (neurons that fire together, wire together)
The Neuron
The Artificial Neuron
Perceptron (Rosenblatt, 1957)
} is half the squared difference between the target output td
and the linear unit output od, summer over all training tuples.
} Here E is a function of weight vector, as the linear unit output
depends on this
Gradient descent search determines
a weight vector (partial differentials)
that minimizes E
Starts with an initial weight vector and
modifies it in steps
At each step the weight vector is altered
In the direction that produces steepest
descent along the error surface
ANN Training
Target

Compare
Feed-Forward Neural N/w topologies
Financial Time Series Modeling:
The case of stock markets
Econometric data
} In econometrics there are three main types of data (not
necessarily mutually exclusive)
} Cross-sectional data
} Time series data
} Panel (longitudinal) data

} All these different data types require specific econometric


and statistical techniques for data analysis
Cross-sectional data
} A type of one-dimensional data set collected by observing
many subjects (such as individuals, firms or
countries/regions) at the same point of time, or without
regarding the differences in time
} In general used to compare the differences among the
subjects I Order does not matter
} Examples: Explaining people’s wages by reference to their
education level
Time series
} A sequence of data points, measured typically at
successive times spaced at uniform time intervals
} Natural one-way ordering of time so that values for a
given period will be expressed as deriving in some way
from past values, rather than from future values
} Have a natural temporal ordering: Annual inflation rates,
daily closing value of a certain stock
Panel data
} Data that involve repeated observations of the same
items over long periods of time
} Not necessarily cohort study
} Panel data (Longitudinal) studies track the same subject
(people, countries, same set of stocks)
} Measurements are observed or taken on the same
subjects repeatedly
Chocolate Production in Australia (1958-1990)
10000
Production (tonns)

9000

8000

7000

6000

5000

4000

3000

2000

1000

0 12 24 36 48 60 72 84 96 108 120 132 144 156 168 180 192 204 216 228 240 252 264 276 288 300 312 324 336 348 360 372 384 396400

Months (Jan 1958-Dec 1990)


Learning a time series
Time Series
} A set of numerical data obtained at regular
periods over time
} Eg.: daily closing prices of stock exchange,
monthly consumer price index, annual
records of sales figures etc.
} Used for quantitative forecasting
J. H. Poynting (1884)
Suppose that while a full band is playing, we could
draw a curve to represent the pressure of the air at a
given moment along a line drawn in the direction in
which the sound is traveling. Such a curve would
appear to fluctuate irregularly. But we know that it is
really made up by the superposition of the perfectly
regular waves of pressure corresponding to the notes
sent out by the all the various instruments, and well
trained ear stationed in the line which can pick out
the notes practically analyses this irregular pressure
curve that is, breaks it up into its simple harmonics.
What is true of this pressure curve is true of all
curves however irregularly they fluctuate, and the ear
performs for the pressure curve what the
mathematician seeks to perform for any other…
Components of Time Series
Y

Time
Q1 Q3 Q1 Q3 Q1 Q3

Trend
Seasonality
Y Y

Time time

Cycle Noise
Time series classical models

} Multiplicative
} Ûi=Ti*Si*Ci*Ii Ti: Trend component
Si: Seasonal component
} Additive Ci: Cyclical component
Ii: Irregular component
} Ûi=Ti+Si+Ci+Ii

} Trend
} Û =bXi+c
i

} Seasonality
} Ûi=b1Xi + b2Q1+ b3Q2 + b3Q3+c
} Seasonality index
Forecasting stock market time series
} Efficient Market Hypothesis
} Week
} Semi-strong
} Strong
} Random Walk Hypothesis
} Implication: Only luck???
Stock Price Forecasting
} Fundamental Analysis
} External factors
} Gold price, exchange rate, oil price etc.
} Technical Analysis
} Moving averages
} Relative strength indicator

} Momentum, M= CCP-OCP
} Stochastic Oscillator
} Price rate of Change Indicator
ANN modeling process
} Data preparation
} Network selection
} Training
} Testing and validation
} Apply and re-train
Sources of Data
} Financial times
} Bloomberg
} Wall street journal
} Reuters
} Yahoo! finance
Data preparation
Training Testing validation
} Input, output selection
} Data Transformation
} Range (say [-1,1])
} First differences
} Logarithmic

} Data sets for training, testing & validation


} Training: oldest, ~70%, inclusive of major patterns in
the data
} Testing: 20-30% of training data
} Validation: remaining, most recent data
Network Topology (architecture)
} Number of hidden layers
} Determines non-linearity
} Problem of over-fitting
} Thumb rule:1-2 hidden layers
} Number of neurons in each layers
} I/p layer: no neurons=no of i/ps
} Hidden layer
} No magic formula- follow experimentation
} Thumb rule: sqrt(no of i/p neurons*no of o/p neurons)
} O/p layer: based on application
Training
} Transfer functions
} Subject to experimentation
} Thumb rule for time series: output layer: linear, rest all:
sigmoid
} Algorithm
} Back propagation most widely used
} GD Target
} GDM

Compare
Model performance & prediction errors
} Mean Square Error (MSE)
} Root Mean Square Error (RMSE)
} Mean Absolute Error (MAE)
} Mean Absolute Percentage Error (MAPE)

You might also like