Project

cofi_cost

0.0
No commit activity in last 3 years
No release in over 3 years
Playground for collaborative filtering in Ruby using NArray and rb-gsl.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
>= 0
 Project Readme

About

Playground for collaborative filtering in Ruby using NArray and rb-gsl.

Usage

Create a variable to store the ratings as an NArray (number of users x number of tracks).

Set the number of features to learn, lambda (regularization parameter), and the number of iterations of gradient descent.

Call min_cost

ratings = NArray[[5.0,4.0,0.0,0.0],[3.0,0.0,0.0,0.0],[4.0,0.0,0.0,0.0],[3.0,0.0,0.0,0.0],[3.0,0.0,0.0,0.0]]
num_features = 2
lambda = 1
iterations = 10
cofi = CofiCost.new(ratings, num_features, lambda, iterations, nil, nil)
cofi.min_cost

The cost and predictions (an NArray of the original size of ratings) can then be
returned after running min_cost:

cofi.cost
cofi.predictions

Installation

gem

rails 3.2

  1. gem ‘cofi_cost’
    in your Gemfile
  2. bundle install
    from the command line

Thank you
Professor Andrew Ng for his wonderful Machine Learning class: ml-class.org

License

MIT License 2012 Thomas Wolfe