Pro Yearly is on sale from $80 to $50! »

Machine Learning with Elixir and Phoenix

Machine Learning with Elixir and Phoenix

Slides for my ElixirConf EU 2017 talk on machine learning.

Facce030b679bda34eb7c64885a741fc?s=128

Eric Weinstein

May 04, 2017
Tweet

Transcript

  1. def talk(struct) do struct |> title("Machine Learning with Elixir and

    Phoenix") |> speaker("Eric Weinstein") |> conf("ElixirConf EU") |> city("Barcelona, España") |> date("4 May 2017") end
  2. for Joshua |##...........................................| 4%

  3. Part 0: Hello! |###..........................................| 7%

  4. May the 4th Be With You |#####........................................| 11%

  5. About Me eric_weinstein = %{employer: "Hulu", github: "ericqweinstein", twitter: "ericqweinstein",

    website: "ericweinste.in"} 30% off with EURORUBY30! |#######......................................| 16%
  6. Agenda • Machine learning and neural networks • A wee

    bit o’ finance • The Phoenix application |#########....................................| 20%
  7. Part 1: Machine Learning |###########..................................| 24%

  8. What is it? |############.................................| 27%

  9. In a word: |#############................................| 29%

  10. Generalization |###############..............................| 33%

  11. What’s Supervised Learning? Classification or regression, generalizing from labeled data

    to unlabeled data |#################............................| 37%
  12. Our Data • Data from the S&P 500 from 2015

    and 2016 • 3 features, 252 instances • https://finance.yahoo.com/quote/SPY/history? p=SPY |##################...........................| 40%
  13. Features && Labels • Bollinger Bands® • Simple moving average

    (SMA) • Relative strength index (RSI) • 20-day return |####################.........................| 44%
  14. Features && Labels • Bollinger Bands® • Simple moving average

    (SMA) • Relative strength index (RSI) • 20-day return |#####################........................| 47%
  15. Neural Networks • Computational model based on biological brains •

    Can model any continuous function (with at least two layers), relatively fast to query, and can model interaction among inputs • However, they are also finicky (often requiring lots of tuning and are prone to overfitting), expensive to train, and black boxes |#######################......................| 50%
  16. |########################.....................| 53% Visualization Image credit: https://en.wikipedia.org/wiki/Artificial_neural_network

  17. Training Rules • Buy when predicted 20-day return is positive

    • Sell when predicted 20-day return is negative • Do nothing when predicted 20-day return is zero (or very close to it) |##########################...................| 57%
  18. Part 2: Finan¢e |###########################..................| 60%

  19. Caveat Emptor • I am not a financial professional •

    No guarantees or warrantees, express or implied, about the completeness or correctness of my experiments • If you repeat them, you can (and probably will) lose money at some point |#############################................| 64%
  20. Some Jargon S&P 500: American index comprising 500 large companies

    Adjusted close: closing price adjusted for historical events (such as stock splits) Stock split: Event where a company splits each existing share into multiple shares (e.g. 2:1) Lookahead bias: Bias introduced by using data that wouldn’t have yet been available in a simulation |##############################...............| 67%
  21. Our Indicators Simple moving average: Arithmetic moving average over a

    specific window Bollinger Bands®: N standard deviations above and below the SMA (oftentimes N = 2) RSI: Momentum indicator that measures speed and change of price movements |################################.............| 71%
  22. Part 3: |#################################............| 74%

  23. |###################################..........| 77%

  24. |####################################.........| 80%

  25. |#####################################........| 83%

  26. |#######################################......| 87%

  27. How’d We Do? • S&P 500 2015 return: -0.73% •

    Our return (training): 2.9% • S&P 500 2016 return: 9.84% • Our return (testing): 16.0% |########################################.....| 90%
  28. Summary • Machine learning is fun and practical • It’s

    super doable with Elixir + BEAM • Library support is what we really need |##########################################...| 93%
  29. Takeaways (TL;DPA) • Be the change you want to see

    in the community! • https://github.com/ericqweinstein/elixirconfeu • http://quantsoftware.gatech.edu |############################################.| 98%
  30. IO.puts("Thanks!") |#############################################| 100%