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
d4d05fa0
Unverified
Commit
d4d05fa0
authored
Jan 21, 2021
by
Thomas J. Fan
Committed by
GitHub
Jan 21, 2021
Browse files
TST Migrates test_consistency.py to pytest (#3798)
parent
4ae4abbe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
74 deletions
+77
-74
tests/python_package_test/test_consistency.py
tests/python_package_test/test_consistency.py
+77
-74
No files found.
tests/python_package_test/test_consistency.py
View file @
d4d05fa0
...
...
@@ -64,9 +64,7 @@ class FileLoader:
return
os
.
path
.
join
(
self
.
directory
,
self
.
prefix
+
suffix
)
class
TestEngine
(
unittest
.
TestCase
):
def
test_binary
(
self
):
def
test_binary
():
fd
=
FileLoader
(
'../../examples/binary_classification'
,
'binary'
)
X_train
,
y_train
,
_
=
fd
.
load_dataset
(
'.train'
)
X_test
,
_
,
X_test_fn
=
fd
.
load_dataset
(
'.test'
)
...
...
@@ -78,7 +76,8 @@ class TestEngine(unittest.TestCase):
fd
.
train_predict_check
(
lgb_train
,
X_test
,
X_test_fn
,
sk_pred
)
fd
.
file_load_check
(
lgb_train
,
'.train'
)
def
test_binary_linear
(
self
):
def
test_binary_linear
():
fd
=
FileLoader
(
'../../examples/binary_classification'
,
'binary'
,
'train_linear.conf'
)
X_train
,
y_train
,
_
=
fd
.
load_dataset
(
'.train'
)
X_test
,
_
,
X_test_fn
=
fd
.
load_dataset
(
'.test'
)
...
...
@@ -90,7 +89,8 @@ class TestEngine(unittest.TestCase):
fd
.
train_predict_check
(
lgb_train
,
X_test
,
X_test_fn
,
sk_pred
)
fd
.
file_load_check
(
lgb_train
,
'.train'
)
def
test_multiclass
(
self
):
def
test_multiclass
():
fd
=
FileLoader
(
'../../examples/multiclass_classification'
,
'multiclass'
)
X_train
,
y_train
,
_
=
fd
.
load_dataset
(
'.train'
)
X_test
,
_
,
X_test_fn
=
fd
.
load_dataset
(
'.test'
)
...
...
@@ -101,7 +101,8 @@ class TestEngine(unittest.TestCase):
fd
.
train_predict_check
(
lgb_train
,
X_test
,
X_test_fn
,
sk_pred
)
fd
.
file_load_check
(
lgb_train
,
'.train'
)
def
test_regression
(
self
):
def
test_regression
():
fd
=
FileLoader
(
'../../examples/regression'
,
'regression'
)
X_train
,
y_train
,
_
=
fd
.
load_dataset
(
'.train'
)
X_test
,
_
,
X_test_fn
=
fd
.
load_dataset
(
'.test'
)
...
...
@@ -113,7 +114,8 @@ class TestEngine(unittest.TestCase):
fd
.
train_predict_check
(
lgb_train
,
X_test
,
X_test_fn
,
sk_pred
)
fd
.
file_load_check
(
lgb_train
,
'.train'
)
def
test_lambdarank
(
self
):
def
test_lambdarank
():
fd
=
FileLoader
(
'../../examples/lambdarank'
,
'rank'
)
X_train
,
y_train
,
_
=
fd
.
load_dataset
(
'.train'
,
is_sparse
=
True
)
X_test
,
_
,
X_test_fn
=
fd
.
load_dataset
(
'.test'
,
is_sparse
=
True
)
...
...
@@ -127,7 +129,8 @@ class TestEngine(unittest.TestCase):
fd
.
train_predict_check
(
lgb_train
,
X_test
,
X_test_fn
,
sk_pred
)
fd
.
file_load_check
(
lgb_train
,
'.train'
)
def
test_xendcg
(
self
):
def
test_xendcg
():
fd
=
FileLoader
(
'../../examples/xendcg'
,
'rank'
)
X_train
,
y_train
,
_
=
fd
.
load_dataset
(
'.train'
,
is_sparse
=
True
)
X_test
,
_
,
X_test_fn
=
fd
.
load_dataset
(
'.test'
,
is_sparse
=
True
)
...
...
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