Class: Leva::Optimizers::Bootstrap

Inherits:
Base
  • Object
show all
Defined in:
app/services/leva/optimizers/bootstrap.rb

Overview

Bootstrap optimization strategy.

Uses simple few-shot bootstrapping to find the best examples that improve model performance. Fast and has no extra dependencies.

Examples:

optimizer = Leva::Optimizers::Bootstrap.new(
  model: "gemini-2.5-flash",
  metric: my_metric,
  mode: :medium
)
result = optimizer.optimize(splits, signature)

Constant Summary collapse

MODES =
{
  light: { trials: 5 },
  medium: { trials: 15 },
  heavy: { trials: 30 }
}.freeze

Instance Attribute Summary

Attributes inherited from Base

#metric, #mode, #model, #progress_callback

Instance Method Summary collapse

Methods inherited from Base

#initialize, #optimize

Constructor Details

This class inherits a constructor from Leva::Optimizers::Base

Instance Method Details

#optimizer_nameObject



28
29
30
# File 'app/services/leva/optimizers/bootstrap.rb', line 28

def optimizer_name
  "Bootstrap"
end

#optimizer_typeObject



32
33
34
# File 'app/services/leva/optimizers/bootstrap.rb', line 32

def optimizer_type
  :bootstrap
end

#step_nameObject



24
25
26
# File 'app/services/leva/optimizers/bootstrap.rb', line 24

def step_name
  "bootstrapping"
end