Skip to content

Commit 4dfac23

Browse files
author
ZebinYang
committed
skip grid search cv in build leaf if param_dict is empty; version 0.2.4
1 parent d77392c commit 4dfac23

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

examples/demo.ipynb

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": null,
66
"metadata": {
77
"ExecuteTime": {
8-
"end_time": "2021-12-15T07:22:42.166872Z",
9-
"start_time": "2021-12-15T07:22:40.227581Z"
8+
"end_time": "2021-12-27T11:25:01.467037Z",
9+
"start_time": "2021-12-27T11:24:59.706592Z"
1010
}
1111
},
1212
"outputs": [],
@@ -29,11 +29,11 @@
2929
},
3030
{
3131
"cell_type": "code",
32-
"execution_count": 2,
32+
"execution_count": null,
3333
"metadata": {
3434
"ExecuteTime": {
35-
"end_time": "2021-12-15T07:22:42.220723Z",
36-
"start_time": "2021-12-15T07:22:42.170592Z"
35+
"end_time": "2021-12-27T11:25:01.500112Z",
36+
"start_time": "2021-12-27T11:25:01.469302Z"
3737
}
3838
},
3939
"outputs": [],
@@ -48,7 +48,8 @@
4848
"execution_count": null,
4949
"metadata": {
5050
"ExecuteTime": {
51-
"start_time": "2021-12-15T07:22:40.159Z"
51+
"end_time": "2021-12-27T11:25:50.669194Z",
52+
"start_time": "2021-12-27T11:25:01.501343Z"
5253
},
5354
"scrolled": true
5455
},
@@ -70,7 +71,8 @@
7071
"execution_count": null,
7172
"metadata": {
7273
"ExecuteTime": {
73-
"start_time": "2021-12-15T07:22:40.160Z"
74+
"end_time": "2021-12-27T11:25:50.670794Z",
75+
"start_time": "2021-12-27T11:25:50.670779Z"
7476
}
7577
},
7678
"outputs": [],
@@ -95,7 +97,8 @@
9597
"execution_count": null,
9698
"metadata": {
9799
"ExecuteTime": {
98-
"start_time": "2021-12-15T07:22:40.164Z"
100+
"end_time": "2021-12-27T11:25:50.671677Z",
101+
"start_time": "2021-12-27T11:25:50.671662Z"
99102
}
100103
},
101104
"outputs": [],
@@ -110,7 +113,8 @@
110113
"execution_count": null,
111114
"metadata": {
112115
"ExecuteTime": {
113-
"start_time": "2021-12-15T07:22:40.165Z"
116+
"end_time": "2021-12-27T11:25:50.672528Z",
117+
"start_time": "2021-12-27T11:25:50.672513Z"
114118
}
115119
},
116120
"outputs": [],
@@ -131,7 +135,8 @@
131135
"execution_count": null,
132136
"metadata": {
133137
"ExecuteTime": {
134-
"start_time": "2021-12-15T07:22:40.166Z"
138+
"end_time": "2021-12-27T11:25:50.673375Z",
139+
"start_time": "2021-12-27T11:25:50.673360Z"
135140
}
136141
},
137142
"outputs": [],

simtree/simtree.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,8 @@ def build_leaf(self, sample_indice):
440440
knot_num=self.knot_num, random_state=self.random_state)
441441
best_estimator.fit(self.x[sample_indice], self.y[sample_indice].ravel())
442442
else:
443+
base = SimRegressor(reg_gamma=self.reg_gamma, degree=self.degree,
444+
knot_num=self.knot_num, random_state=self.random_state)
443445
grid = GridSearchCV(base, param_grid={"reg_lambda": self.reg_lambda},
444446
scoring={"mse": make_scorer(mean_squared_error, greater_is_better=False)},
445447
cv=5, refit="mse", n_jobs=1, error_score=np.nan)

0 commit comments

Comments
 (0)