Skip to content

Instantly share code, notes, and snippets.

@mathias-brandewinder
Created July 24, 2013 18:33
Show Gist options
  • Save mathias-brandewinder/6073191 to your computer and use it in GitHub Desktop.
Save mathias-brandewinder/6073191 to your computer and use it in GitHub Desktop.
namespace FSharpTests
module Analytics =
open System
let getData (skuId: int) =
// fake data for now:
// a list of (date, value) observations
[ DateTime(2010, 1, 1), 10.;
DateTime(2010, 1, 2), 20.;
DateTime(2010, 1, 3), 30.;]
let predict (history: (DateTime * float) seq) =
// dumbest predictor that could work:
// pick latest observation (date,value),
// predict that value forever
let latest = history |> Seq.maxBy fst
snd latest
let predictForSku (skuId: int) =
let history = getData skuId
predict history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment