Skip to content

Instantly share code, notes, and snippets.

@ashleyw
Created September 20, 2011 19:10
Show Gist options
  • Save ashleyw/1230015 to your computer and use it in GitHub Desktop.
Save ashleyw/1230015 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'slope_one'
user_data = {
"alice" => {
"squid" => 1,
"cuttlefish" => 0.5,
"octopus" => 0.2
},
"bob" => {
"squid" => 1,
"octopus" => 0.5,
"nautilus" => 0.2
},
"carole" => {
"squid" => 0.2,
"octopus" => 1,
"cuttlefish" => 0.4,
"nautilus" => 0.4
},
"dave" => {
"octopus" => 0.4,
"cuttlefish" => 0.9,
"nautilus" => 0.5
}
}
slope_one = SlopeOne.new
slope_one.insert(user_data)
puts slope_one.predict({"squid" => 0.4}).inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment