Git Product home page Git Product logo

libffm-ruby's Introduction

LIBFFM Ruby

LIBFFM - field-aware factorization machines - for Ruby

Build Status

Installation

Add this line to your application’s Gemfile:

gem "libffm"

Getting Started

Prep your data in LIBFFM format

0 0:0:1 1:1:1
1 0:2:1 1:3:1

Create a model

model = Libffm::Model.new
model.fit("train.txt")

Make predictions

model.predict("test.txt")

Save the model to a file

model.save_model("model.bin")

Load the model from a file

model.load_model("model.bin")

Pass a validation set

model.fit("train.txt", eval_set: "validation.txt")

Parameters

Pass parameters - default values below

Libffm::Model.new(
  eta: 0.2,                # learning rate
  lambda: 0.00002,         # regularization parameter
  nr_iters: 15,            # number of iterations
  k: 4,                    # number of latent factors
  normalization: true,     # use instance-wise normalization
  auto_stop: false         # stop at the iteration that achieves the best validation loss
)

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone --recursive https://github.com/ankane/libffm-ruby.git
cd libffm-ruby
bundle install
bundle exec rake compile
bundle exec rake test

libffm-ruby's People

Contributors

ankane avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.