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
9c3e2718
Commit
9c3e2718
authored
Dec 01, 2016
by
Guolin Ke
Committed by
GitHub
Dec 01, 2016
Browse files
Update simple_example.py
parent
16d1853d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
examples/python-guide/simple_example.py
examples/python-guide/simple_example.py
+7
-0
No files found.
examples/python-guide/simple_example.py
View file @
9c3e2718
...
...
@@ -8,3 +8,10 @@ rng = np.random.RandomState(2016)
X
,
y
=
datasets
.
make_classification
(
n_samples
=
10000
,
n_features
=
100
)
x_train
,
x_test
,
y_train
,
y_test
=
model_selection
.
train_test_split
(
X
,
y
,
test_size
=
0.1
,
random_state
=
1
)
lgb_model
=
lgb
.
LGBMClassifier
(
n_estimators
=
100
).
fit
(
x_train
,
y_train
,
[(
x_test
,
y_test
)],
eval_metric
=
"auc"
)
lgb_model
.
predict
(
x_test
)
# save model
lgb_model
.
booster
().
save_model
(
'model.txt'
)
# load model
booster
=
lgb
.
Booster
(
model_file
=
'model.txt'
)
# predict
print
(
booster
.
predict
(
x_test
))
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