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
b38a19a4
Commit
b38a19a4
authored
Mar 24, 2017
by
Guolin Ke
Browse files
fix test.
parent
99c6b539
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
tests/python_package_test/test_engine.py
tests/python_package_test/test_engine.py
+2
-2
No files found.
tests/python_package_test/test_engine.py
View file @
b38a19a4
...
@@ -33,7 +33,7 @@ class template(object):
...
@@ -33,7 +33,7 @@ class template(object):
def
test_template
(
params
=
{
'objective'
:
'regression'
,
'metric'
:
'l2'
},
def
test_template
(
params
=
{
'objective'
:
'regression'
,
'metric'
:
'l2'
},
X_y
=
load_boston
(
True
),
feval
=
mean_squared_error
,
X_y
=
load_boston
(
True
),
feval
=
mean_squared_error
,
num_round
=
200
,
init_model
=
None
,
custom_eval
=
None
,
num_round
=
200
,
init_model
=
None
,
custom_eval
=
None
,
early_stopping_rounds
=
10
,
early_stopping_rounds
=
5
,
return_data
=
False
,
return_model
=
False
):
return_data
=
False
,
return_model
=
False
):
params
[
'verbose'
],
params
[
'seed'
]
=
-
1
,
42
params
[
'verbose'
],
params
[
'seed'
]
=
-
1
,
42
X_train
,
X_test
,
y_train
,
y_test
=
train_test_split
(
*
X_y
,
test_size
=
0.1
,
random_state
=
42
)
X_train
,
X_test
,
y_train
,
y_test
=
train_test_split
(
*
X_y
,
test_size
=
0.1
,
random_state
=
42
)
...
@@ -97,7 +97,7 @@ class TestEngine(unittest.TestCase):
...
@@ -97,7 +97,7 @@ class TestEngine(unittest.TestCase):
evals_result
,
ret
=
template
.
test_template
(
params
,
feval
=
mean_absolute_error
,
evals_result
,
ret
=
template
.
test_template
(
params
,
feval
=
mean_absolute_error
,
num_round
=
80
,
init_model
=
model_name
,
num_round
=
80
,
init_model
=
model_name
,
custom_eval
=
(
lambda
p
,
d
:
(
'mae'
,
mean_absolute_error
(
p
,
d
.
get_label
()),
False
)))
custom_eval
=
(
lambda
p
,
d
:
(
'mae'
,
mean_absolute_error
(
p
,
d
.
get_label
()),
False
)))
self
.
assertLess
(
ret
,
3
)
self
.
assertLess
(
ret
,
3
.5
)
self
.
assertAlmostEqual
(
min
(
evals_result
[
'eval'
][
'l1'
]),
ret
,
places
=
5
)
self
.
assertAlmostEqual
(
min
(
evals_result
[
'eval'
][
'l1'
]),
ret
,
places
=
5
)
for
l1
,
mae
in
zip
(
evals_result
[
'eval'
][
'l1'
],
evals_result
[
'eval'
][
'mae'
]):
for
l1
,
mae
in
zip
(
evals_result
[
'eval'
][
'l1'
],
evals_result
[
'eval'
][
'mae'
]):
self
.
assertAlmostEqual
(
l1
,
mae
,
places
=
5
)
self
.
assertAlmostEqual
(
l1
,
mae
,
places
=
5
)
...
...
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