Predicting outcomes with Pattern Recognition: Machine Learning for Algorithmic Trading p. 8

Using previous pattern outcomes to help us begin to predict future outcomes.

Welcome to the Machine Learning for Forex and Stock analysis and automated trading tutorial series. In this series, you will be taught how to apply machine learning and pattern recognition principles to the field of stocks and forex.

This is especially useful for people interested in quantitative analysis and algo or high frequency trading. Even if you are not, the series will still be of great use to anyone interested in learning about machine learning and automatic pattern recognition, through a hands-on tutorial series.

Sentdex.com
Facebook.com/sentdex
Twitter.com/sentdex

8 comments

  1. dfrusdn says:

    Got the same results but I also have this error in somewhere in
    PatternRecognition(). Can’t figure out where. module1:30: RuntimeWarning:
    divide by zero encountered in double_scalars

  2. sentdex says:

    Hmm, well, the first place to look would be in each of the places where we
    divide by an unknown #, or array. We do a lot of averaging … so it is
    probably happening there where it is dividing by a length of 0 because an
    array didn’t get populated for some reason. I’ve run this for ~8,000
    samples and not had the issue. Are you having it immediately? or mid-way
    through? 

  3. dfrusdn says:

    I continued further in the tutorial and it disappeared. very strange. The
    error was printed and skipped and I still got the same data come out.

  4. sentdex says:

    Sounds like it was caught by a try and except. Probably just a pattern that
    wasn’t filled in the first round or something. I went back and ran to see
    if I could find the error, and I couldn’t Somewhere you’re dividing by 0
    and it’s probably in one of the averaging lambda 1-liners. If you continue
    to see it, it’ll probably cause problems down the line. Definitely want to
    figure out what is wrong.

  5. Jason Turner says:

    I go through the whole process no errors but the predicted outcome is not
    printing.Only the current pattern, pattern storage takes to long and the
    pattern recognition doesn’t print like it does for you. I don’t see the
    lines in between etc.and this takes me 1004.8870008 seconds to print the
    whole process. while yours take 7 seconds, why?

  6. Antonio Constandinou says:

    i got a similar error as below – seems like I may be dividing by 0

    File “C:UsersantoniozeusDesktopmachinelearning.py”, line 22
    return ((float(currentPoint – startPoint)/abs(startPoint)))*100.00
    RuntimeWarning: divide by zero encountered in double_scalars

  7. Jinex2010 says:

    So, I am currently developing this in QT C++. It took me 2 hours to
    discover that the abs() function applied on the startPoint in the
    percentChange function caused Nan error on every single computation ran by
    the paaternRecognition function. It was the fault of the Qt’s abs()
    function. The std::abs() works fine! (#include )

  8. Yue Liu says:

    Hi, I went through step by step and got weird outcomes for
    patternRecognition(). When I calculated patterns, some elements
    (percentChange) of them are tiny small so that when I computed “sim”, some
    eachpattern[i] are relatively much smaller than patternForRec[i]. As a
    result, the corresponding percentChange(eachpattern[i],patternForRec[i]) is
    far more bigger than 100, and I got a lot of VERY negative values for sims.
    I checked the whole program and I don’t know why I cannot get the similar
    results as yours :(

Comments are closed.