Unverified Commit 86a085f7 authored by Nikita Titov's avatar Nikita Titov Committed by GitHub
Browse files

[tests][python] Add test for single leaf in linear tree (#4015)

* Update test_engine.py

* Update python_package.yml

* Update python_package.yml

* Update test_engine.py

* hotfix
parent 0e576575
......@@ -2604,6 +2604,19 @@ def test_save_and_load_linear(tmp_path):
np.testing.assert_allclose(pred_2, pred_3)
def test_linear_single_leaf():
X_train, y_train = load_breast_cancer(return_X_y=True)
train_data = lgb.Dataset(X_train, label=y_train)
params = {
"objective": "binary",
"linear_tree": True,
"min_sum_hessian": 5000
}
bst = lgb.train(params, train_data, num_boost_round=5)
y_pred = bst.predict(X_train)
assert log_loss(y_train, y_pred) < 0.661
def test_predict_with_start_iteration():
def inner_test(X, y, params, early_stopping_rounds):
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.1, random_state=42)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment