Skip to content

Commit 9d8ca66

Browse files
author
igor_rukhovich
committed
caching fix #2
1 parent c6e738a commit 9d8ca66

File tree

3 files changed

+114
-84
lines changed

3 files changed

+114
-84
lines changed

configs/cpu_lgbm_gbt_config.json

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,106 @@
106106
}
107107
]
108108
}
109+
110+
111+
{
112+
"algorithm": "xgb_mb",
113+
"dataset": [
114+
{
115+
"source": "csv",
116+
"name": "mortgage1Q",
117+
"training":
118+
{
119+
"x": "../sklbench_data/mortgage_x.csv",
120+
"y": "../sklbench_data/mortgage_y.csv"
121+
}
122+
}
123+
],
124+
"n-estimators": [100],
125+
"objective": ["reg:squarederror"],
126+
"tree-method": ["hist"],
127+
"max-depth": [8],
128+
"scale-pos-weight": [2],
129+
"learning-rate": [0.1],
130+
"subsample": [1],
131+
"reg-alpha": [0.9],
132+
"reg-lambda": [1],
133+
"min-child-weight": [0],
134+
"max-leaves": [256]
135+
},
136+
{
137+
"algorithm": "xgb_mb",
138+
"dataset": [
139+
{
140+
"source": "csv",
141+
"name": "airline-ohe",
142+
"training":
143+
{
144+
"x": "../sklbench_data/airline-ohe_x_train.csv",
145+
"y": "../sklbench_data/airline-ohe_y_train.csv"
146+
}
147+
}
148+
],
149+
"reg-alpha": [0.9],
150+
"max-bin": [256],
151+
"scale-pos-weight": [2],
152+
"learning-rate": [0.1],
153+
"subsample": [1],
154+
"reg-lambda": [1],
155+
"min-child-weight": [0],
156+
"max-depth": [8],
157+
"max-leaves": [256],
158+
"n-estimators": [1000],
159+
"objective": ["binary:logistic"],
160+
"tree-method": ["hist"]
161+
},
162+
{
163+
"algorithm": "xgb_mb",
164+
"dataset": [
165+
{
166+
"source": "csv",
167+
"name": "higgs1m",
168+
"training":
169+
{
170+
"x": "../sklbench_data/higgs1m_x_train.csv",
171+
"y": "../sklbench_data/higgs1m_y_train.csv"
172+
}
173+
}
174+
],
175+
"reg-alpha": [0.9],
176+
"max-bin": [256],
177+
"scale-pos-weight": [2],
178+
"learning-rate": [0.1],
179+
"subsample": [1],
180+
"reg-lambda": [1],
181+
"min-child-weight": [0],
182+
"max-depth": [8],
183+
"max-leaves": [256],
184+
"n-estimators": [1000],
185+
"objective": ["binary:logistic"],
186+
"tree-method": ["hist"]
187+
},
188+
{
189+
"algorithm": "xgb_mb",
190+
"dataset": [
191+
{
192+
"source": "csv",
193+
"name": "msrank",
194+
"training":
195+
{
196+
"x": "../sklbench_data/mlsr_x_train.csv",
197+
"y": "../sklbench_data/mlsr_y_train.csv"
198+
}
199+
}
200+
],
201+
"max-bin": [256],
202+
"learning-rate": [0.3],
203+
"subsample": [1],
204+
"reg-lambda": [2],
205+
"min-child-weight": [1],
206+
"min-split-loss": [0.1],
207+
"max-depth": [8],
208+
"n-estimators": [200],
209+
"objective": ["multi:softprob"],
210+
"tree-method": ["hist"]
211+
}

configs/cpu_xgb_gbt_config.json

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -8,57 +8,6 @@
88
"count-dmatrix": [""]
99
},
1010
"cases": [
11-
{
12-
"algorithm": "xgb_mb",
13-
"dataset": [
14-
{
15-
"source": "csv",
16-
"name": "mortgage1Q",
17-
"training":
18-
{
19-
"x": "../sklbench_data/mortgage_x.csv",
20-
"y": "../sklbench_data/mortgage_y.csv"
21-
}
22-
}
23-
],
24-
"n-estimators": [100],
25-
"objective": ["reg:squarederror"],
26-
"tree-method": ["hist"],
27-
"max-depth": [8],
28-
"scale-pos-weight": [2],
29-
"learning-rate": [0.1],
30-
"subsample": [1],
31-
"reg-alpha": [0.9],
32-
"reg-lambda": [1],
33-
"min-child-weight": [0],
34-
"max-leaves": [256]
35-
},
36-
{
37-
"algorithm": "xgb_mb",
38-
"dataset": [
39-
{
40-
"source": "csv",
41-
"name": "airline-ohe",
42-
"training":
43-
{
44-
"x": "../sklbench_data/airline-ohe_x_train.csv",
45-
"y": "../sklbench_data/airline-ohe_y_train.csv"
46-
}
47-
}
48-
],
49-
"reg-alpha": [0.9],
50-
"max-bin": [256],
51-
"scale-pos-weight": [2],
52-
"learning-rate": [0.1],
53-
"subsample": [1],
54-
"reg-lambda": [1],
55-
"min-child-weight": [0],
56-
"max-depth": [8],
57-
"max-leaves": [256],
58-
"n-estimators": [1000],
59-
"objective": ["binary:logistic"],
60-
"tree-method": ["hist"]
61-
},
6211
{
6312
"algorithm": "xgb_mb",
6413
"dataset": [
@@ -84,30 +33,6 @@
8433
"n-estimators": [1000],
8534
"objective": ["binary:logistic"],
8635
"tree-method": ["hist"]
87-
},
88-
{
89-
"algorithm": "xgb_mb",
90-
"dataset": [
91-
{
92-
"source": "csv",
93-
"name": "msrank",
94-
"training":
95-
{
96-
"x": "../sklbench_data/mlsr_x_train.csv",
97-
"y": "../sklbench_data/mlsr_y_train.csv"
98-
}
99-
}
100-
],
101-
"max-bin": [256],
102-
"learning-rate": [0.3],
103-
"subsample": [1],
104-
"reg-lambda": [2],
105-
"min-child-weight": [1],
106-
"min-split-loss": [0.1],
107-
"max-depth": [8],
108-
"n-estimators": [200],
109-
"objective": ["multi:softprob"],
110-
"tree-method": ["hist"]
11136
}
11237
]
11338
}

modelbuilders/xgb_mb.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,17 @@
111111

112112
t_creat_test, dtest = measure_function_time(xgb.DMatrix, X_test, params=params)
113113

114-
def fit(dtrain=None):
115-
if dtrain is None:
116-
dtrain = xgb.DMatrix(X_train, y_train)
117-
return xgb.train(xgb_params, dtrain, params.n_estimators)
118-
119-
def predict(dtest=None):
120-
if dtest is None:
121-
dtest = xgb.DMatrix(X_test, y_test)
122-
return model_xgb.predict(dtest)
114+
def fit(dmatrix=None):
115+
print("DTRAIN IS", dmatrix, file=stderr)
116+
if dmatrix is None:
117+
dmatrix = xgb.DMatrix(X_train, y_train)
118+
return xgb.train(xgb_params, dmatrix, params.n_estimators)
119+
120+
def predict(dmatrix=None):
121+
print("DTEST IS", dmatrix, file=stderr)
122+
if dmatrix is None:
123+
dmatrix = xgb.DMatrix(X_test, y_test)
124+
return model_xgb.predict(dmatrix)
123125

124126
t_train, model_xgb = measure_function_time(fit, dtrain if params.count_dmatrix else None, params=params)
125127
y_train_pred = 0 # model_xgb.predict(dtrain)

0 commit comments

Comments
 (0)