You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: With numpy>=1.24, np.int is deprecated but still used in catboost
catboost version: 1.2
Operating System: Debian
CPU: Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
GPU: not used
from catboost import CatBoostRegressor
# Initialize data
train_data = [[1, 4, 5, 6],
[4, 5, 6, 7],
[30, 40, 50, 60]]
eval_data = [[2, 4, 6, 8],
[1, 4, 50, 60]]
train_labels = [10, 20, 30]
# Initialize CatBoostRegressor
model = CatBoostRegressor(iterations=2,
learning_rate=1,
depth=2)
# Fit model
model.fit(train_data, train_labels)
# Get predictions
preds = model.predict(eval_data)
preds
This all works.
But model.calc_feature_statistics(train_data, train_labels) would return:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 model.calc_feature_statistics(train_data, train_labels)
File /opt/my_dir/.venv/lib/python3.9/site-packages/catboost/core.py:3801, in CatBoost.calc_feature_statistics(self, data, target, feature, prediction_type, cat_feature_values, plot, max_cat_features_on_plot, thread_count, plot_file)
3799 float_features_nums.append(feature_internal_index)
3800 feature_type_mapper.append('float')
-> 3801 results = [self._object._get_binarized_statistics(
3802 data_item,
3803 cat_features_nums,
3804 float_features_nums,
3805 prediction_type,
3806 thread_count
3807 ) for data_item in data]
3808 # res = [dict, dict, ..., dict, dict, dict, ..., dict ]
3809 # | stat for cat features | | stat for float features |
3810 statistics_by_feature = defaultdict(list)
[snip]
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
Problem: With
numpy>=1.24
,np.int
is deprecated but still used incatboost
catboost version: 1.2
Operating System: Debian
CPU: Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
GPU: not used
MWE: Using the example from https://catboost.ai/en/docs/concepts/python-usages-examples
This all works.
But
model.calc_feature_statistics(train_data, train_labels)
would return:https://numpy.org/devdocs/release/1.20.0-notes.html#using-the-aliases-of-builtin-types-like-np-int-is-deprecated
This worked with catboost 1.1.1 with numpy 1.22.3.
The text was updated successfully, but these errors were encountered: