Skip to content

Commit 61dc037

Browse files
committed
Added test for model_from_string [skip ci]
1 parent a058b77 commit 61dc037

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/booster_test.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ def test_model_str
1515
assert_elements_in_delta [0.9823112229173586, 0.9583143724610858], y_pred.first(2)
1616
end
1717

18+
def test_model_from_string
19+
x_test = [[3.7, 1.2, 7.2, 9.0], [7.5, 0.5, 7.9, 0.0]]
20+
booster = LightGBM.train(binary_params, binary_train)
21+
booster.model_from_string(File.read("test/support/model.txt"))
22+
y_pred = booster.predict(x_test)
23+
assert_elements_in_delta [0.9823112229173586, 0.9583143724610858], y_pred.first(2)
24+
end
25+
1826
def test_feature_importance
1927
assert_equal [280, 285, 335, 148], booster.feature_importance
2028
end

0 commit comments

Comments
 (0)