1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-16 09:11:00 +08:00

Fix code with block.

This commit is contained in:
lwwang1995
2020-11-27 22:44:28 +08:00
parent c5a3b74a96
commit 1353e81b5b
7 changed files with 42 additions and 136 deletions

View File

@@ -47,9 +47,7 @@ class XGBModel(Model):
# Lightgbm need 1D array as its label
if y_train.values.ndim == 2 and y_train.values.shape[1] == 1:
y_train_1d, y_valid_1d = np.squeeze(y_train.values), np.squeeze(
y_valid.values
)
y_train_1d, y_valid_1d = np.squeeze(y_train.values), np.squeeze(y_valid.values)
else:
raise ValueError("XGBoost doesn't support multi-label training")
@@ -72,6 +70,4 @@ class XGBModel(Model):
if self.model is None:
raise ValueError("model is not fitted yet!")
x_test = dataset.prepare("test", col_set="feature")
return pd.Series(
self.model.predict(xgb.DMatrix(x_test.values)), index=x_test.index
)
return pd.Series(self.model.predict(xgb.DMatrix(x_test.values)), index=x_test.index)