-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
json.h:73: Invalid cast, from Object to Array #7926
Comments
Could you please share how to reproduce it? |
sure, let me think how to: mmmmm I have a large dataframe with categorical features and numerical, ubuntu, python 3.9.... bye |
Could you please share a reproducible example that we can run and see the error? I can't guess based on your description. :-). |
you right at all..........let me arrange an example.....is not easy but i can.......stay tune...and thanks a lot luigi |
I DID! FOLLOWING: INSTALLATION PACKET pip install xgboost==1.5.2
-EVERYTHING OK pip install --upgrade xgboost -RUN THE PROGRAM AND THE ERROR COME UP!!!!!
|
my program above (xgboost_debug_v2.py): #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 12 17:25:34 2021
@author: luigi
"""
import os
#import sys
#from os import path
import pandas as pd
import numpy as np
import sys
#import shutil
import xgboost as xgb
import pyarrow
#################################################
X_train_0_100_debug = pd.read_parquet('/home/luigi/debug_xgboost/X_train_0_100.zip')
#X_train_debug = pd.read_parquet('/home/luigi/debug_xgboost/X_train.zip')
X_validation_0_100_debug = pd.read_parquet('/home/luigi/debug_xgboost/X_validation_0_100.zip')
#X_validation_debug = pd.read_parquet('/home/luigi/debug_xgboost/X_validation.zip')
#label_encoded_y_train_debug=pd.read_csv('/home/luigi/debug_xgboost/label_encoded_y_train.csv')
#label_encoded_y_train_debug=label_encoded_y_train_debug['target']
label_encoded_y_train_0_100_debug=pd.read_csv('/home/luigi/debug_xgboost/label_encoded_y_train_0_100.csv')
label_encoded_y_train_0_100_debug=label_encoded_y_train_0_100_debug['target']
#label_encoded_y_validation_debug=pd.read_csv('/home/luigi/debug_xgboost/label_encoded_y_validation.csv')
#label_encoded_y_validation_debug=label_encoded_y_validation_debug['target']
label_encoded_y_validation_0_100_debug=pd.read_csv('/home/luigi/debug_xgboost/label_encoded_y_validation_0_100.csv')
label_encoded_y_validation_0_100_debug=label_encoded_y_validation_0_100_debug['target']
from xgboost import XGBClassifier
#model_XGB = XGBClassifier(tree_method="gpu_hist",enable_categorical=True,n_estimators=100,early_stopping_rounds=100,max_depth=12)
model_XGB = XGBClassifier(tree_method="gpu_hist",enable_categorical=True)
eval_set= [(X_validation_0_100_debug, label_encoded_y_validation_0_100_debug)]
model_XGB.fit(X_train_0_100_debug,label_encoded_y_train_0_100_debug,eval_set=eval_set) |
Couldn't reproduce it with master branch, trying it with 1.6.1 now. |
I can't reproduce it with 1.6.1 either, but I have found the cause: You have 1.5.1 |
uaooooooooo....great trivialfis!!!! ...it ....I'm going to try what you kindly suggest.......wait ....i hope ..... |
(base) luigi@DM2:/home/luigi$ conda remove libxgboost still waiting......ahhhhhhhhh |
conda remove libxgboost take a long time.....still solving....waiting ( i remember i tried some days ago but after hours nothing....!?!?!?! |
yes, just delete the file ... or , you can use mamba instead of conda. |
conda remove --force libxgboost conda list | grep xgboost -> nothing Collecting package metadata (current_repodata.json): done Package Planenvironment location: /home/luigi/miniconda3 added / updated specs: The following packages will be downloaded:
The following packages will be REMOVED: argh-0.26.2-pyh9f0ad1d_1002 The following packages will be UPDATED: importlib-metadata 4.11.3-py39hf3d152e_1 --> 4.11.4-py39hf3d152e_0 Proceed ([y]/n)? Downloading and Extracting Packages (base) luigi@DM2:/home/luigi$ pip install xgboost ./xgboost_debug_v2.py YESSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS YEAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH for the time , for the patient best regards luigi |
noooooo |
let me investigate..... |
pip install xgboost==1.5.2 get back to 1.5.2, NO ERROR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
pip install --upgrade xgboost (base) luigi@DM2:/home/luigi$ pip list | grep xgboost (base) luigi@DM2:/home/luigi$ conda list | grep xgboost /home/luigi/miniconda3/lib/python3.9/site-packages/xgboost/data.py:323: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling Stack trace: |
aaaaaaaaaaaaahhhhhhhhhhhhhhh why????? |
some dataframes, only xgboost intalled......1.5.2 non error, 1.6.1 error:/categorical.h:82: Check failed: max_cat + 1 >= n_categories (1.5335 vs. 2) : Maximum cateogry should not be lesser than the total number of categories. |
same program, same dataframes: 1.5.2 NO ERROR, 1.6.1 ERROR.............................................. |
sorry it's normal i know, but with the other dataframes (only 0-100lines) 1.6.1 was fine!?!?!?!? |
i need time to rest..............the computer science is not deterministic also when it is........i know |
:-) |
but what means:Check failed: max_cat + 1 >= n_categories (1.5335 vs. 2) : Maximum cateogry should not be lesser than the total number of categories.!?!?!?!?!?!? |
ahhhh it is not 15335 but 1.5335!!!?!?!?!? |
this should be a bug of 1.6.1!?!?!? |
n_categories=2 ??????????? i have thousands categories...... |
go back to 1.5.2......waiting rest time.......thanks a lot anyway [trivialfis]...that's very kind oy you luigi |
Hi, please provide something that we can run and see the error? I'm confused by your comments. ;-) |
Closing due to stalled. |
Dear all,
with xgboost 1.5.2 no error
with 1.6.0 or 1.6.1 i meet the subject error: json.h:73: Invalid cast, from Object to Array
Has anyone any idea how to fix?
thanks a lot in advance
luigi
The text was updated successfully, but these errors were encountered: