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
4f77bd28
Commit
4f77bd28
authored
Feb 20, 2017
by
Guolin Ke
Browse files
update to v2.
parent
13d4581b
Changes
64
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
59 deletions
+20
-59
tests/python_package_test/test_basic.py
tests/python_package_test/test_basic.py
+5
-5
tests/python_package_test/test_engine.py
tests/python_package_test/test_engine.py
+1
-44
windows/LightGBM.vcxproj
windows/LightGBM.vcxproj
+2
-1
windows/LightGBM.vcxproj.filters
windows/LightGBM.vcxproj.filters
+12
-9
No files found.
tests/python_package_test/test_basic.py
View file @
4f77bd28
...
@@ -6,21 +6,21 @@ import unittest
...
@@ -6,21 +6,21 @@ import unittest
import
lightgbm
as
lgb
import
lightgbm
as
lgb
import
numpy
as
np
import
numpy
as
np
from
sklearn.datasets
import
load_breast_cancer
from
sklearn.datasets
import
load_breast_cancer
,
dump_svmlight_file
from
sklearn.model_selection
import
train_test_split
from
sklearn.model_selection
import
train_test_split
class
TestBasic
(
unittest
.
TestCase
):
class
TestBasic
(
unittest
.
TestCase
):
def
test
(
self
):
def
test
(
self
):
X_train
,
X_test
,
y_train
,
y_test
=
train_test_split
(
*
load_breast_cancer
(
True
),
test_size
=
0.1
,
random_state
=
1
)
X_train
,
X_test
,
y_train
,
y_test
=
train_test_split
(
*
load_breast_cancer
(
True
),
test_size
=
0.1
,
random_state
=
2
)
train_data
=
lgb
.
Dataset
(
X_train
,
max_bin
=
255
,
label
=
y_train
)
train_data
=
lgb
.
Dataset
(
X_train
,
max_bin
=
255
,
label
=
y_train
)
valid_data
=
train_data
.
create_valid
(
X_test
,
label
=
y_test
)
valid_data
=
train_data
.
create_valid
(
X_test
,
label
=
y_test
)
params
=
{
params
=
{
"objective"
:
"binary"
,
"objective"
:
"binary"
,
"metric"
:
"auc"
,
"metric"
:
"auc"
,
"min_data"
:
1
,
"min_data"
:
1
0
,
"num_leaves"
:
15
,
"num_leaves"
:
15
,
"verbose"
:
-
1
"verbose"
:
-
1
}
}
...
@@ -36,7 +36,7 @@ class TestBasic(unittest.TestCase):
...
@@ -36,7 +36,7 @@ class TestBasic(unittest.TestCase):
with
tempfile
.
NamedTemporaryFile
()
as
f
:
with
tempfile
.
NamedTemporaryFile
()
as
f
:
tname
=
f
.
name
tname
=
f
.
name
with
open
(
tname
,
"w+b"
)
as
f
:
with
open
(
tname
,
"w+b"
)
as
f
:
np
.
savetxt
(
f
,
X_test
,
delimiter
=
','
)
dump_svmlight_file
(
X_test
,
y_test
,
f
)
pred_from_file
=
bst
.
predict
(
tname
)
pred_from_file
=
bst
.
predict
(
tname
)
os
.
remove
(
tname
)
os
.
remove
(
tname
)
self
.
assertEqual
(
len
(
pred_from_matr
),
len
(
pred_from_file
))
self
.
assertEqual
(
len
(
pred_from_matr
),
len
(
pred_from_file
))
...
@@ -49,7 +49,7 @@ class TestBasic(unittest.TestCase):
...
@@ -49,7 +49,7 @@ class TestBasic(unittest.TestCase):
for
preds
in
zip
(
pred_from_matr
,
pred_from_model_file
):
for
preds
in
zip
(
pred_from_matr
,
pred_from_model_file
):
self
.
assertEqual
(
*
preds
)
self
.
assertEqual
(
*
preds
)
# check pmml
# check pmml
os
.
system
(
'python ../../pmml/pmml.py model.txt'
)
#
os.system('python ../../pmml/pmml.py model.txt')
print
(
"----------------------------------------------------------------------"
)
print
(
"----------------------------------------------------------------------"
)
...
...
tests/python_package_test/test_engine.py
View file @
4f77bd28
This diff is collapsed.
Click to expand it.
windows/LightGBM.vcxproj
View file @
4f77bd28
This diff is collapsed.
Click to expand it.
windows/LightGBM.vcxproj.filters
View file @
4f77bd28
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
Next
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