README.md in libmf-0.1.3 vs README.md in libmf-0.2.0

- old
+ new

@@ -1,11 +1,13 @@ # LIBMF [LIBMF](https://github.com/cjlin1/libmf) - large-scale sparse matrix factorization - for Ruby -[![Build Status](https://travis-ci.org/ankane/libmf.svg?branch=master)](https://travis-ci.org/ankane/libmf) +Check out [Disco](https://github.com/ankane/disco) for higher-level collaborative filtering +[![Build Status](https://travis-ci.org/ankane/libmf.svg?branch=master)](https://travis-ci.org/ankane/libmf) [![Build status](https://ci.appveyor.com/api/projects/status/92fbip1bd8sjd2tj/branch/master?svg=true)](https://ci.appveyor.com/project/ankane/libmf/branch/master) + ## Installation Add this line to your application’s Gemfile: ```ruby @@ -94,12 +96,11 @@ lambda_q2: 0.1, # coefficient of L2-norm regularization on Q learning_rate: 0.1, # learning rate alpha: 0.1, # importance of negative entries c: 0.0001, # desired value of negative entries nmf: false, # perform non-negative MF (NMF) - quiet: false, # no outputs to stdout - copy_data: true # copy data in training procedure + quiet: false # no outputs to stdout ) ``` ### Loss Functions @@ -119,10 +120,36 @@ - 10 - row-oriented pair-wise logarithmic loss - 11 - column-oriented pair-wise logarithmic loss - 12 - squared error (L2-norm) +## Performance + +For performance, read data directly from files + +```ruby +model.fit("train.txt", eval_set: "validate.txt") +model.cv("train.txt") +``` + +Data should be in the format `row_index column_index value`: + +```txt +0 0 5.0 +0 2 3.5 +1 1 4.0 +``` + +## Numo + +Get latent factors as Numo arrays + +```ruby +model.p_factors(format: :numo) +model.q_factors(format: :numo) +``` + ## Resources - [LIBMF: A Library for Parallel Matrix Factorization in Shared-memory Systems](https://www.csie.ntu.edu.tw/~cjlin/papers/libmf/libmf_open_source.pdf) ## History @@ -135,5 +162,15 @@ - [Report bugs](https://github.com/ankane/libmf/issues) - Fix bugs and [submit pull requests](https://github.com/ankane/libmf/pulls) - Write, clarify, or fix documentation - Suggest or add new features + +To get started with development: + +```sh +git clone --recursive https://github.com/ankane/libmf.git +cd libmf +bundle install +bundle exec rake vendor:all +bundle exec rake test +```