Project

wandb

0.0
The project is in a healthy, maintained state
Log model runs to Weights & Biases
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0
 Project Readme

Ruby Weights & Biases

A Ruby integration for the Weights & Biases AI platform. Log model and visualize model runs easily.

Example Integration

require "xgb"
require "wandb"
require "easy_ml"
require "polars-df"

df = Polars::DataFrame.new({
    "annual_revenue" => [1000, 2000, 3000],
    "loan_purpose" => %w[payroll expansion marketing],
    "rev" => [100, 200, 300],
    "date" => %w[2021-01-01 2021-05-01 2022-01-01],
}).with_column(
    Polars.col("date").str.strptime(Polars::Datetime, "%Y-%m-%d")
)

dataset = EasyML::Data::Dataset.new({
    datasource: df,
    target: "rev",
    splitter: { date: { date_col: "date", months_test: 2, months_valid: 2 } }
})

Wandb.login(api_key: "abc")
Wandb.init(project: "my-sweet-project")

model = EasyML::Core::Models::XGBoost.new(
  task: :regression,
  dataset: dataset,
  callbacks: [
    Wandb::XGBoostCallback.new(
        log_model: true,
        log_feature_importance: true,
        importance_type: :gain
    )
  ],
  hyperparameters: {
    learning_rate: 0.05,
    max_depth: 8,
    n_estimators: 150,
    booster: "gbtree",
    objective: "reg:squarederror"
  }
)

model.fit
wandb.finish

Installation

gem install wandb

Usage

Currently has deep integration with XGBoost Ruby, but if you want to manually log metrics with other tools:

Wandb.login(api_key: "your-key")
Wanbd.init(project: "my-project")
Wandb.log({
    metric: 123,
    other_metric: 456
})