Skip to content
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

Pool Creation Error - TypeError: must be real number, not NoneType #2613

Open
irmakyucel opened this issue Mar 14, 2024 · 1 comment
Open

Comments

@irmakyucel
Copy link

Problem: After using a loaded model using catboost load, in the model.predict_proba() function I am facing the error below:
Initially I thought it was about automatic pool creation of catboost so I explicitly created the Pool() but faced the exact same error in that function.

Traceback (most recent call last):
File "/argo/staging/script", line 14, in
model_predict(date)
File "/opt/workflow/app/pipeline/skorlama.py", line 22, in model_predict
pool = Pool(data=df_skor.values, label=None, cat_features=model.get_cat_feature_indices())
File "/usr/local/lib64/python3.9/site-packages/catboost/core.py", line 645, in init
self._init(data, label, cat_features, text_features, embedding_features, pairs, weight,
File "/usr/local/lib64/python3.9/site-packages/catboost/core.py", line 1222, in _init
self._init_pool(data, label, cat_features, text_features, embedding_features, pairs, weight,
File "_catboost.pyx", line 3763, in _catboost._PoolBase._init_pool
File "_catboost.pyx", line 3827, in _catboost._PoolBase._init_pool
File "_catboost.pyx", line 3736, in _catboost._PoolBase._init_objects_order_layout_pool
File "_catboost.pyx", line 3269, in _catboost._set_data
File "_catboost.pyx", line 3222, in _catboost._set_data_from_generic_matrix
File "_catboost.pyx", line 2238, in _catboost.get_cat_factor_bytes_representation
File "_catboost.pyx", line 1857, in _catboost.get_id_object_bytes_string_representation
TypeError: must be real number, not NoneType

catboost version: tried 1.0.6, 1.2.0 and 1.2.3
Operating System: Linux
CPU: yes
GPU: no

@Evgueni-Petrov-aka-espetrov
Copy link
Contributor

hi!
could you please post an end-to-end reproducer?
the thing below works fine...

from catboost import CatBoostClassifier, Pool

train_data = [[0, 3],
              [4, 1],
              [8, 1],
              [9, 1]]
train_labels = [0, 0, 1, 1]

model = CatBoostClassifier(
        iterations=1000,
)
model.fit(
        train_data,
        train_labels,
        verbose=False,
        cat_features=[0]
)

pred = model.predict_proba(train_data)

pool = Pool(data=train_data, label=None, cat_features=model.get_cat_feature_indices())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants