Created
July 24, 2013 18:33
-
-
Save mathias-brandewinder/6073191 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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