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
1632da1d
Commit
1632da1d
authored
Apr 28, 2026
by
tianlh
Browse files
add lightgbm_test.py
parent
9d239114
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
lightgbm_test.py
lightgbm_test.py
+18
-0
No files found.
lightgbm_test.py
0 → 100644
View file @
1632da1d
import
lightgbm
as
lgb
import
numpy
as
np
from
datetime
import
datetime
from
sklearn.datasets
import
make_regression
X
,
y
=
make_regression
(
n_samples
=
1000000
,
n_features
=
40
,
n_informative
=
20
,
random_state
=
42
)
print
(
f
'训练开始:
{
datetime
.
now
()
}
'
)
train_data
=
lgb
.
Dataset
(
X
,
label
=
y
)
params
=
{
"objective"
:
"regression"
,
"metric"
:
"mse"
,
"device"
:
"cuda"
,
"num_threads"
:
-
1
,
"verbosity"
:
1
,
"max_depth"
:
6
,
"learning_rate"
:
0.05
}
model
=
lgb
.
train
(
params
,
train_data
,
num_boost_round
=
500
)
print
(
f
'训练结束:
{
datetime
.
now
()
}
'
)
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