Skip to content

Commit

Permalink
Use int instead of numpy.int, fixes #2378
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgueni-Petrov-aka-espetrov committed May 10, 2023
1 parent d48d720 commit e586366
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion catboost/python-package/catboost/_catboost.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1253,7 +1253,7 @@ cdef _vector_of_uints_to_np_array(const TVector[ui32]& vec):


cdef _vector_of_ints_to_np_array(const TVector[int]& vec):
result = np.empty(vec.size(), dtype=np.int)
result = np.empty(vec.size(), dtype=int)
for i in xrange(vec.size()):
result[i] = vec[i]
return result
Expand Down
13 changes: 13 additions & 0 deletions catboost/python-package/ut/medium/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11006,3 +11006,16 @@ def test_ranker_with_fixed_splits(task_type):
train_labels = [0, 1, 0]
group_id = [10, 20, 20]
model.fit(train_data, train_labels, group_id=group_id)


def test_github_issue_2378_numpy_int_is_deprecated():
train_data = [[1, 4, 5, 6],
[4, 5, 6, 7],
[30, 40, 50, 60]]

train_labels = [10, 20, 30]
model = CatBoostRegressor(iterations=2,
learning_rate=1,
depth=2)
model.fit(train_data, train_labels)
model.calc_feature_statistics(train_data, train_labels, plot=False)

0 comments on commit e586366

Please sign in to comment.