Skip to content

Instantly share code, notes, and snippets.

View wizzor's full-sized avatar

Visa Parviainen wizzor

View GitHub Profile
@wizzor
wizzor / line.rb
Created December 17, 2015 12:04 — forked from actsasgeek/line.rb
ruby implementation of gradient descent linear regression
require 'generator'
samples = [
{ :xs => [ 1.0, 0.25], :y => 0.98},
{ :xs => [ 1.0, 0.49], :y => 0.82},
{ :xs => [ 1.0, 0.60], :y => 0.41},
{ :xs => [ 1.0, 0.89], :y => 0.31}
]
# line is the sum of the dot product of the weight (thetas)