0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

LightGBMError: The number of features in data (75) is not the same as it was in training data (74).

Last updated at Posted at 2023-03-05

LightGBMError: The number of features in data (75) is not the same as it was in training data (74).
You can set predict_disable_shape_check=true to discard this error, but please be aware what you are doing.

モデルに渡すデータの特徴量数が異なる場合に表示されるエラー
predict_disable_shape_check=Trueを引数に渡すと、
エラー回避できるが誤った予測を得る可能性がある

pred = model.predict(df, predict_disable_shape_check=True)

そもそもカラム数が異なる場合、必要な処理が抜けているのかも

df_origin = df.drop('y', axis=1)
pred = model.predict(df_origin)

Reference

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?