We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 64568be commit 036a033Copy full SHA for 036a033
1 file changed
lib/xgboost/model.rb
@@ -20,6 +20,8 @@ def save_model(fname)
20
21
def load_model(fname)
22
@booster = Booster.new(params: @params, model_file: fname)
23
+ config = JSON.parse(@booster.save_config)
24
+ load_model_attributes(config)
25
end
26
27
def feature_importances
@@ -29,5 +31,11 @@ def feature_importances
29
31
total = scores.sum.to_f
30
32
scores.map { |s| s / total }
33
34
+
35
+ private
36
37
+ def load_model_attributes(config)
38
+ @objective = config["learner"]["objective"]["name"]
39
+ end
40
41
0 commit comments