views:

330

answers:

5

which algorithms exist for time series forecasting/regression ? what about using neural networks ? (best docs about this topic ?) are there python libraries/code snippets that can help ?

A: 

There are some libraries out there that might help:lokad

If you want to work completely on your own then numpy/scipy should be of help.

pyfunc
well i was aware of both, but this doesn't answer the question :)
gpilotino
+2  A: 

I've no idea about python libraries, but there are good forecasting algorithms in R which are open source. See the forecast package for code and references for time series forecasting.

Rob Hyndman
+1  A: 

Speaking only about the algorithms behind them, I recently used the double exponential smoothing in a project and it did well by forecasting new values when there is a trend in the data.

The implementation is pretty trivial, but maybe the algorithm is not sufficiently elaborated for your case.

GaretJax
+1  A: 

Did you tried Autocorrelation for finding periodical patterns in time series ? You can do that with numpy.correlate function.

0x69
sounds interesting, do you have an example or a link with some snippets ?
gpilotino
I don't know if it helps, but you can try to check here- http://dr-adorio-adventures.blogspot.com/2010/04/computing-sample-partial.html Also check very good Python computer algebra system SAGE- http://www.sagemath.org/doc/reference/sage/finance/time_series.html
0x69
+7  A: 

The classical approaches to time series regression are:

  • auto-regressive models (there are whole literatures about them)

  • Gaussian Processes

  • Fourier decomposition or similar to extract the periodic components of the signal (i.e., hidden oscillations in the data)

Other less common approaches that I know about are

  • Slow Feature Analysis, an algorithm that extract the driving forces of a time series, e.g., the parameters behind a chaotic signal

  • Neural Network (NN) approaches, either using recurrent NNs (i.e., built to process time signals) or classical feed-forward NNs that receive as input part of the past data and try to predict a point in the future; the advantage of the latter is that recurrent NNs are known to have a problem with taking into account the distant past

In my opinion for financial data analysis it is important to obtain not only a best-guess extrapolation of the time series, but also a reliable confidence interval, as the resulting investment strategy could be very different depending on that. Probabilistic methods, like Gaussian Processes, give you that "for free", as they return a probability distribution over possible future values. With classical statistical methods you'll have to rely on bootstrapping techniques.

There are many Python libraries that offer statistical and Machine Learning tools, here are the ones I'm most familiar with:

  • NumPy and SciPy are a must for scientific programming in Python
  • There is a Python interface to R, called RPy
  • scikits.learn, MDP, MLPy, Orange are collections of machine learning algorithms
  • PyBrain contains (among other things) implementations of feed-forward and recurrent neural networks
  • at the Gaussian Process site there is a list of GP software, including two Python implementations
  • mloss is a directory of open source machine learning software
pberkes
thank you, very in-depth =)
gpilotino