Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
cd4459a1
Unverified
Commit
cd4459a1
authored
Jul 10, 2024
by
Nikita Titov
Committed by
GitHub
Jul 10, 2024
Browse files
[test][python] fix pandas DeprecationWarning about `is_sparse` function (#6532)
parent
4292b168
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
tests/python_package_test/test_engine.py
tests/python_package_test/test_engine.py
+1
-1
tests/python_package_test/test_sklearn.py
tests/python_package_test/test_sklearn.py
+1
-1
No files found.
tests/python_package_test/test_engine.py
View file @
cd4459a1
...
@@ -1812,7 +1812,7 @@ def test_pandas_sparse(rng):
...
@@ -1812,7 +1812,7 @@ def test_pandas_sparse(rng):
}
}
)
)
for
dtype
in
pd
.
concat
([
X
.
dtypes
,
X_test
.
dtypes
,
pd
.
Series
(
y
.
dtypes
)]):
for
dtype
in
pd
.
concat
([
X
.
dtypes
,
X_test
.
dtypes
,
pd
.
Series
(
y
.
dtypes
)]):
assert
pd
.
api
.
types
.
is_s
parse
(
d
type
)
assert
isinstance
(
dtype
,
pd
.
S
parse
D
type
)
params
=
{
"objective"
:
"binary"
,
"verbose"
:
-
1
}
params
=
{
"objective"
:
"binary"
,
"verbose"
:
-
1
}
lgb_train
=
lgb
.
Dataset
(
X
,
y
)
lgb_train
=
lgb
.
Dataset
(
X
,
y
)
gbm
=
lgb
.
train
(
params
,
lgb_train
,
num_boost_round
=
10
)
gbm
=
lgb
.
train
(
params
,
lgb_train
,
num_boost_round
=
10
)
...
...
tests/python_package_test/test_sklearn.py
View file @
cd4459a1
...
@@ -638,7 +638,7 @@ def test_pandas_sparse(rng):
...
@@ -638,7 +638,7 @@ def test_pandas_sparse(rng):
}
}
)
)
for
dtype
in
pd
.
concat
([
X
.
dtypes
,
X_test
.
dtypes
,
pd
.
Series
(
y
.
dtypes
)]):
for
dtype
in
pd
.
concat
([
X
.
dtypes
,
X_test
.
dtypes
,
pd
.
Series
(
y
.
dtypes
)]):
assert
pd
.
api
.
types
.
is_s
parse
(
d
type
)
assert
isinstance
(
dtype
,
pd
.
S
parse
D
type
)
gbm
=
lgb
.
sklearn
.
LGBMClassifier
(
n_estimators
=
10
).
fit
(
X
,
y
)
gbm
=
lgb
.
sklearn
.
LGBMClassifier
(
n_estimators
=
10
).
fit
(
X
,
y
)
pred_sparse
=
gbm
.
predict
(
X_test
,
raw_score
=
True
)
pred_sparse
=
gbm
.
predict
(
X_test
,
raw_score
=
True
)
if
hasattr
(
X_test
,
"sparse"
):
if
hasattr
(
X_test
,
"sparse"
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment