Sha256: c979eeeae1dd1c8e2da562ae7a7e36bc3f8b11d765e5f7174cc2b7e4392c2bde

Contents?: true

Size: 672 Bytes

Versions: 19

Compression:

Stored size: 672 Bytes

Contents

module LightGBM
  class Model
    attr_reader :booster

    def initialize(num_leaves: 31, learning_rate: 0.1, n_estimators: 100, objective: nil, **options)
      @params = {
        num_leaves: num_leaves,
        learning_rate: learning_rate
      }.merge(options)
      @params[:objective] = objective if objective
      @n_estimators = n_estimators
    end

    def save_model(fname)
      @booster.save_model(fname)
    end

    def load_model(fname)
      @booster = Booster.new(params: @params, model_file: fname)
    end

    def best_iteration
      @booster.best_iteration
    end

    def feature_importances
      @booster.feature_importance
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
lightgbm-0.3.4 lib/lightgbm/model.rb
lightgbm-0.3.3 lib/lightgbm/model.rb
lightgbm-0.3.2 lib/lightgbm/model.rb
lightgbm-0.3.1 lib/lightgbm/model.rb
lightgbm-0.3.0 lib/lightgbm/model.rb
lightgbm-0.2.7 lib/lightgbm/model.rb
lightgbm-0.2.6 lib/lightgbm/model.rb
lightgbm-0.2.5 lib/lightgbm/model.rb
lightgbm-0.2.4 lib/lightgbm/model.rb
lightgbm-0.2.3 lib/lightgbm/model.rb
lightgbm-0.2.2 lib/lightgbm/model.rb
lightgbm-0.2.1 lib/lightgbm/model.rb
lightgbm-0.2.0 lib/lightgbm/model.rb
lightgbm-0.1.9 lib/lightgbm/model.rb
lightgbm-0.1.8 lib/lightgbm/model.rb
lightgbm-0.1.7 lib/lightgbm/model.rb
lightgbm-0.1.6 lib/lightgbm/model.rb
lightgbm-0.1.5 lib/lightgbm/model.rb
lightgbm-0.1.4 lib/lightgbm/model.rb