Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vowpalwabbit

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vowpalwabbit

  • 0.3.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Vowpal Wabbit Ruby

Vowpal Wabbit - fast online machine learning - for Ruby

Build Status

Installation

First, install the Vowpal Wabbit C++ library. For Homebrew, use:

brew install vowpal-wabbit

And for Ubuntu, use:

sudo apt install libvw0

Then add this line to your application’s Gemfile:

gem "vowpalwabbit"

Getting Started

Prep your data

x = [[1, 2], [3, 4], [5, 6], [7, 8]]
y = [1, 2, 3, 4]

Train a model

model = VowpalWabbit::Regressor.new(learning_rate: 100)
model.fit(x, y)

Use VowpalWabbit::Classifier for classification and VowpalWabbit::Model for other models

Make predictions

model.predict(x)

Save the model to a file

model.save("model.bin")

Load the model from a file

model = VowpalWabbit::Regressor.load("model.bin")

Train online

model.partial_fit(x, y)

Get the intercept and coefficients

model.intercept
model.coefs

Score - R-squared for regression and accuracy for classification

model.score(x, y)

Parameters

Specify parameters

model = VowpalWabbit::Model.new(cb: 4)

Supports the same parameters as the CLI

Data

Data can be an array of arrays

[[1, 2, 3], [4, 5, 6]]

Or a Numo array

Numo::NArray.cast([[1, 2, 3], [4, 5, 6]])

Or an array of strings

[
  "0 | price:.23 sqft:.25 age:.05 2006",
  "1 2 'second_house | price:.18 sqft:.15 age:.35 1976",
  "0 1 0.5 'third_house | price:.53 sqft:.32 age:.87 1924"
]

Or a path to a file

model.fit("train.txt")
model.partial_fit("train.txt")
model.predict("train.txt")
model.score("train.txt")

Files can be compressed

model.fit("train.txt.gz")

Read more about the input format

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 https://github.com/ankane/vowpalwabbit-ruby.git
cd vowpalwabbit-ruby
bundle install
bundle exec rake test

FAQs

Package last updated on 23 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc