Muskan Aggarwal
Muskan Aggarwal

Reputation: 1

Facing error in applying classifier model

I am facing the following error even after encoding the categorical columns:

ValueError: DataFrame.dtypes for data must be int, float, bool or category. When categorical type is supplied, The experimental DMatrix parameterenable_categorical must be set to True. Invalid columns:hotel: object, arrival_date_month: object, meal: object, country: object, market_segment: object, distribution_channel: object, reserved_room_type: object, assigned_room_type: object, deposit_type: object, customer_type: object, reservation_status: object, reservation_status_date: object

The code is: model = XGBClassifier(random_state=42) model.fit(X_train, y_train)

I am expecting to find out the fault in my codeand provide me the correct way.

Thank you for your time.

Upvotes: 0

Views: 38

Answers (1)

krishna
krishna

Reputation: 1

You need to encode (one-hot encoding or label encoding) categorical variables or drop them.

Upvotes: 0

Related Questions