FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
docker-python/tests/test_lightgbm.py at master · opensourceai/docker-python · GitHub
opensourceai
/
docker-python
Public
forked from
Kaggle/docker-python
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
docker-python
/
tests
/
test_lightgbm.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
37 lines (30 loc) · 1.17 KB
Breadcrumbs
docker-python
/
tests
/
test_lightgbm.py
Copy path
File metadata and controls
37 lines (30 loc) · 1.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import
unittest
import
lightgbm
as
lgb
from
sklearn
.
datasets
import
load_iris
class
TestLightgbm
(
unittest
.
TestCase
):
# Based on the "simple_example" from their documentation:
# https://github.com/Microsoft/LightGBM/blob/master/examples/python-guide/simple_example.py
def
test_simple
(
self
):
# Load a dataset aleady on disk
iris
=
load_iris
()
lgb_train
=
lgb
.
Dataset
(
iris
.
data
[:
100
],
iris
.
target
[:
100
])
lgb_eval
=
lgb
.
Dataset
(
iris
.
data
[
100
:],
iris
.
target
[
100
:],
reference
=
lgb_train
)
params
=
{
'task'
:
'train'
,
'boosting_type'
:
'gbdt'
,
'objective'
:
'regression'
,
'metric'
: {
'l2'
,
'auc'
},
'num_leaves'
:
31
,
'learning_rate'
:
0.05
,
'feature_fraction'
:
0.9
,
'bagging_fraction'
:
0.8
,
'bagging_freq'
:
5
,
'verbose'
:
0
}
# Run only one round for faster test
gbm
=
lgb
.
train
(
params
,
lgb_train
,
num_boost_round
=
1
,
valid_sets
=
lgb_eval
,
early_stopping_rounds
=
1
)
self
.
assertEqual
(
1
,
gbm
.
best_iteration
)
Back
|
FazBrowse Home
|
New Git URL