1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-12 23:36:54 +08:00

Update all baseline models.

This commit is contained in:
lwwang1995
2020-11-27 22:30:05 +08:00
parent 7952d79932
commit bebce24a7c
17 changed files with 282 additions and 856 deletions

View File

@@ -41,14 +41,18 @@ class CatBoostModel(Model):
**kwargs
):
df_train, df_valid = dataset.prepare(
["train", "valid"], col_set=["feature", "label"], data_key=DataHandlerLP.DK_L
["train", "valid"],
col_set=["feature", "label"],
data_key=DataHandlerLP.DK_L,
)
x_train, y_train = df_train["feature"], df_train["label"]
x_valid, y_valid = df_valid["feature"], df_valid["label"]
# CatBoost needs 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("CatBoost doesn't support multi-label training")