README.md in libmf-0.2.6 vs README.md in libmf-0.3.0
- old
+ new
@@ -9,11 +9,11 @@
## Installation
Add this line to your application’s Gemfile:
```ruby
-gem 'libmf'
+gem "libmf"
```
## Getting Started
Prep your data in the format `row_index, column_index, value`
@@ -52,17 +52,17 @@
```
Save the model to a file
```ruby
-model.save_model("model.txt")
+model.save("model.txt")
```
Load the model from a file
```ruby
-model.load_model("model.txt")
+model = Libmf::Model.load("model.txt")
```
Pass a validation set
```ruby
@@ -97,11 +97,11 @@
lambda_p1: 0, # coefficient of L1-norm regularization on P
lambda_p2: 0.1, # coefficient of L2-norm regularization on P
lambda_q1: 0, # coefficient of L1-norm regularization on Q
lambda_q2: 0.1, # coefficient of L2-norm regularization on Q
learning_rate: 0.1, # learning rate
- alpha: 0.1, # importance of negative entries
+ alpha: 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
)
```
@@ -124,10 +124,54 @@
- `:one_class_row` - row-oriented pair-wise logarithmic loss
- `:one_class_col` - column-oriented pair-wise logarithmic loss
- `:one_class_l2` - squared error (L2-norm)
+## Metrics
+
+Calculate RMSE (for real-valued MF)
+
+```ruby
+model.rmse(data)
+```
+
+Calculate MAE (for real-valued MF)
+
+```ruby
+model.mae(data)
+```
+
+Calculate generalized KL-divergence (for non-negative real-valued MF)
+
+```ruby
+model.gkl(data)
+```
+
+Calculate logarithmic loss (for binary MF)
+
+```ruby
+model.logloss(data)
+```
+
+Calculate accuracy (for binary MF)
+
+```ruby
+model.accuracy(data)
+```
+
+Calculate MPR (for one-class MF)
+
+```ruby
+model.mpr(data, transpose)
+```
+
+Calculate AUC (for one-class MF)
+
+```ruby
+model.auc(data, transpose)
+```
+
## Performance
For performance, read data directly from files
```ruby
@@ -170,10 +214,10 @@
- Suggest or add new features
To get started with development:
```sh
-git clone --recursive https://github.com/ankane/libmf-ruby.git
+git clone https://github.com/ankane/libmf-ruby.git
cd libmf-ruby
bundle install
bundle exec rake vendor:all
bundle exec rake test
```