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
962a9937
Unverified
Commit
962a9937
authored
Jul 01, 2021
by
Sean Takafuji
Committed by
GitHub
Jul 01, 2021
Browse files
add type hints to init for LGBMModel (#4420)
parent
6a195a1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
7 deletions
+25
-7
python-package/lightgbm/sklearn.py
python-package/lightgbm/sklearn.py
+25
-7
No files found.
python-package/lightgbm/sklearn.py
View file @
962a9937
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
"""Scikit-learn wrapper interface for LightGBM."""
"""Scikit-learn wrapper interface for LightGBM."""
import
copy
import
copy
from
inspect
import
signature
from
inspect
import
signature
from
typing
import
Callable
,
Dict
,
Optional
,
Union
import
numpy
as
np
import
numpy
as
np
...
@@ -348,13 +349,30 @@ _lgbmmodel_doc_predict = (
...
@@ -348,13 +349,30 @@ _lgbmmodel_doc_predict = (
class
LGBMModel
(
_LGBMModelBase
):
class
LGBMModel
(
_LGBMModelBase
):
"""Implementation of the scikit-learn API for LightGBM."""
"""Implementation of the scikit-learn API for LightGBM."""
def
__init__
(
self
,
boosting_type
=
'gbdt'
,
num_leaves
=
31
,
max_depth
=-
1
,
def
__init__
(
learning_rate
=
0.1
,
n_estimators
=
100
,
self
,
subsample_for_bin
=
200000
,
objective
=
None
,
class_weight
=
None
,
boosting_type
:
str
=
'gbdt'
,
min_split_gain
=
0.
,
min_child_weight
=
1e-3
,
min_child_samples
=
20
,
num_leaves
:
int
=
31
,
subsample
=
1.
,
subsample_freq
=
0
,
colsample_bytree
=
1.
,
max_depth
:
int
=
-
1
,
reg_alpha
=
0.
,
reg_lambda
=
0.
,
random_state
=
None
,
learning_rate
:
float
=
0.1
,
n_jobs
=-
1
,
silent
=
True
,
importance_type
=
'split'
,
**
kwargs
):
n_estimators
:
int
=
100
,
subsample_for_bin
:
int
=
200000
,
objective
:
Optional
[
Union
[
str
,
Callable
]]
=
None
,
class_weight
:
Optional
[
Union
[
Dict
,
str
]]
=
None
,
min_split_gain
:
float
=
0.
,
min_child_weight
:
float
=
1e-3
,
min_child_samples
:
int
=
20
,
subsample
:
float
=
1.
,
subsample_freq
:
int
=
0
,
colsample_bytree
:
float
=
1.
,
reg_alpha
:
float
=
0.
,
reg_lambda
:
float
=
0.
,
random_state
:
Optional
[
Union
[
int
,
np
.
random
.
RandomState
]]
=
None
,
n_jobs
:
int
=
-
1
,
silent
:
bool
=
True
,
importance_type
:
str
=
'split'
,
**
kwargs
):
r
"""Construct a gradient boosting model.
r
"""Construct a gradient boosting model.
Parameters
Parameters
...
...
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