You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error: ValueError: train and valid dataset categorical_feature do not match.
setting:
clf = lgb.train(params=params, train_set=lgb_train,
valid_sets=[lgb_train, lgb_test],
valid_names=['train', 'test'],
feval=ks_metric,
categorical_feature=cflist)
when categorical_feature is set to a listA with columns not in train_set columns(listB), it works well when train and predict onsite.
but after save_model to file and reload it by lgb.Booster().
and try to lgb.predict(X) with a new dataframe with the proper feature list(listB) used in training, it output the above error, and it's not removed if i added the listA in X.
So, is it possible to make the current model work in predicting? what should i add as parameters perhaps?
The text was updated successfully, but these errors were encountered:
That error usually means that the columns in your input dataframe that are expected to be categoricals are not. Can you make sure that they are? e.g. X[listB] = X[listB].astype('category').
lgb version 4.5.0
error: ValueError: train and valid dataset categorical_feature do not match.
setting:
clf = lgb.train(params=params, train_set=lgb_train,
valid_sets=[lgb_train, lgb_test],
valid_names=['train', 'test'],
feval=ks_metric,
categorical_feature=cflist)
when categorical_feature is set to a listA with columns not in train_set columns(listB), it works well when train and predict onsite.
but after save_model to file and reload it by lgb.Booster().
and try to lgb.predict(X) with a new dataframe with the proper feature list(listB) used in training, it output the above error, and it's not removed if i added the listA in X.
So, is it possible to make the current model work in predicting? what should i add as parameters perhaps?
The text was updated successfully, but these errors were encountered: