Skip to content

Instantly share code, notes, and snippets.

View s9xie's full-sized avatar

Saining Xie s9xie

View GitHub Profile
@Javran
Javran / gist:8431352
Created January 15, 2014 05:37
gradient descent in haskell
realworldFunc x = x * 0.5 + 1.23
dataSize = 100
dataSet = take dataSize $ map (\x -> (x,realworldFunc x)) [1..]
gdAlgo alpha (initT0, initT1) = (newT0,newT1)
where
hypo x = x * initT1 + initT0
newT0 = initT0 - theConst * (sum theDiffs)