Skip to content

Commit 036a033

Browse files
committed
Synced code [skip ci]
1 parent 64568be commit 036a033

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/xgboost/model.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ def save_model(fname)
2020

2121
def load_model(fname)
2222
@booster = Booster.new(params: @params, model_file: fname)
23+
config = JSON.parse(@booster.save_config)
24+
load_model_attributes(config)
2325
end
2426

2527
def feature_importances
@@ -29,5 +31,11 @@ def feature_importances
2931
total = scores.sum.to_f
3032
scores.map { |s| s / total }
3133
end
34+
35+
private
36+
37+
def load_model_attributes(config)
38+
@objective = config["learner"]["objective"]["name"]
39+
end
3240
end
3341
end

0 commit comments

Comments
 (0)