-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getting CatBoostError: Invalid cat_features[6] = 22 value: index must be < 22 but len(x_train.columns) is 23 #2607
Comments
Can you give more detailed information to reproduce? I cannot reproduce this error. Here's the code that works without problems for me. import numpy as np
import pandas as pd
from catboost import CatBoostRegressor
n_samples = 10
x_train_dict = {}
for i in range(23):
x_train_dict[str(i)] = np.random.random_integers(100, size=n_samples)
x_train = pd.DataFrame(x_train_dict)
y_train = np.random.random_sample(n_samples)
quantile_str = '0.1,0.9'
print(len(x_train.columns)) # this returns 23
categorical_positions = [11,12,13,17,20,21,22]
model = CatBoostRegressor(iterations=100,
loss_function=f'MultiQuantile:alpha={quantile_str}', cat_features=categorical_positions)
model.fit(x_train, y_train) |
andrey-khropov
changed the title
getting atBoostError: Invalid cat_features[6] = 22 value: index must be < 22 but len(x_train.columns) is 23
getting CatBoostError: Invalid cat_features[6] = 22 value: index must be < 22 but len(x_train.columns) is 23
Apr 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem: getting "catBoostError: Invalid cat_features[6] = 22 value: index must be < 22" but len(cat_features) = 23
catboost version:1.2.3
Operating System: Linux 24.01.30
CPU:4 cores, 28 GB RAM, 56 GB disk
GPU:
`
print(x_train.columns)
print(len(x_train.columns)) # this returns 23
categorical_positions = [11,12,13,17,20,21,22]
model = CatBoostRegressor(iterations=100,
loss_function=f'MultiQuantile:alpha={quantile_str}', cat_features=categorical_positions)
model.fit(x_train, y_train)
`
The text was updated successfully, but these errors were encountered: