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
b60294b8
Unverified
Commit
b60294b8
authored
May 12, 2020
by
Nikita Titov
Committed by
GitHub
May 12, 2020
Browse files
removed deprecated code (#3073)
parent
05d89a1a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
37 deletions
+2
-37
python-package/lightgbm/plotting.py
python-package/lightgbm/plotting.py
+2
-32
src/objective/binary_objective.hpp
src/objective/binary_objective.hpp
+0
-5
No files found.
python-package/lightgbm/plotting.py
View file @
b60294b8
...
...
@@ -9,7 +9,7 @@ from io import BytesIO
import
numpy
as
np
from
.basic
import
Booster
from
.compat
import
(
MATPLOTLIB_INSTALLED
,
GRAPHVIZ_INSTALLED
,
LGBMDeprecationWarning
,
from
.compat
import
(
MATPLOTLIB_INSTALLED
,
GRAPHVIZ_INSTALLED
,
range_
,
zip_
,
string_type
)
from
.sklearn
import
LGBMModel
...
...
@@ -329,7 +329,7 @@ def plot_metric(booster, metric=None, dataset_names=None,
num_metric
=
len
(
metrics_for_one
)
if
metric
is
None
:
if
num_metric
>
1
:
msg
=
"
""m
ore than one metric available, picking one to plot."
""
msg
=
"
M
ore than one metric available, picking one to plot."
warnings
.
warn
(
msg
,
stacklevel
=
2
)
metric
,
results
=
metrics_for_one
.
popitem
()
else
:
...
...
@@ -471,9 +471,6 @@ def _to_graphviz(tree_info, show_info, feature_names, precision=3,
def
create_tree_digraph
(
booster
,
tree_index
=
0
,
show_info
=
None
,
precision
=
3
,
old_name
=
None
,
old_comment
=
None
,
old_filename
=
None
,
old_directory
=
None
,
old_format
=
None
,
old_engine
=
None
,
old_encoding
=
None
,
old_graph_attr
=
None
,
old_node_attr
=
None
,
old_edge_attr
=
None
,
old_body
=
None
,
old_strict
=
False
,
orientation
=
'horizontal'
,
**
kwargs
):
"""Create a digraph representation of specified tree.
...
...
@@ -512,23 +509,6 @@ def create_tree_digraph(booster, tree_index=0, show_info=None, precision=3,
elif
not
isinstance
(
booster
,
Booster
):
raise
TypeError
(
'booster must be Booster or LGBMModel.'
)
for
param_name
in
[
'old_name'
,
'old_comment'
,
'old_filename'
,
'old_directory'
,
'old_format'
,
'old_engine'
,
'old_encoding'
,
'old_graph_attr'
,
'old_node_attr'
,
'old_edge_attr'
,
'old_body'
]:
param
=
locals
().
get
(
param_name
)
if
param
is
not
None
:
warnings
.
warn
(
'{0} parameter is deprecated and will be removed in 2.4 version.
\n
'
'Please use **kwargs to pass {1} parameter.'
.
format
(
param_name
,
param_name
[
4
:]),
LGBMDeprecationWarning
)
if
param_name
[
4
:]
not
in
kwargs
:
kwargs
[
param_name
[
4
:]]
=
param
if
locals
().
get
(
'strict'
):
warnings
.
warn
(
'old_strict parameter is deprecated and will be removed in 2.4 version.
\n
'
'Please use **kwargs to pass strict parameter.'
,
LGBMDeprecationWarning
)
if
'strict'
not
in
kwargs
:
kwargs
[
'strict'
]
=
True
model
=
booster
.
dump_model
()
tree_infos
=
model
[
'tree_info'
]
if
'feature_names'
in
model
:
...
...
@@ -553,7 +533,6 @@ def create_tree_digraph(booster, tree_index=0, show_info=None, precision=3,
def
plot_tree
(
booster
,
ax
=
None
,
tree_index
=
0
,
figsize
=
None
,
dpi
=
None
,
old_graph_attr
=
None
,
old_node_attr
=
None
,
old_edge_attr
=
None
,
show_info
=
None
,
precision
=
3
,
orientation
=
'horizontal'
,
**
kwargs
):
"""Plot specified tree.
...
...
@@ -600,15 +579,6 @@ def plot_tree(booster, ax=None, tree_index=0, figsize=None, dpi=None,
else
:
raise
ImportError
(
'You must install matplotlib to plot tree.'
)
for
param_name
in
[
'old_graph_attr'
,
'old_node_attr'
,
'old_edge_attr'
]:
param
=
locals
().
get
(
param_name
)
if
param
is
not
None
:
warnings
.
warn
(
'{0} parameter is deprecated and will be removed in 2.4 version.
\n
'
'Please use **kwargs to pass {1} parameter.'
.
format
(
param_name
,
param_name
[
4
:]),
LGBMDeprecationWarning
)
if
param_name
[
4
:]
not
in
kwargs
:
kwargs
[
param_name
[
4
:]]
=
param
if
ax
is
None
:
if
figsize
is
not
None
:
_check_not_tuple_of_2_elements
(
figsize
,
'figsize'
)
...
...
src/objective/binary_objective.hpp
View file @
b60294b8
...
...
@@ -59,11 +59,6 @@ class BinaryLogloss: public ObjectiveFunction {
weights_
=
metadata
.
weights
();
data_size_t
cnt_positive
=
0
;
data_size_t
cnt_negative
=
0
;
// REMOVEME: remove the warning after 2.4 version release
Log
::
Warning
(
"Starting from the 2.1.2 version, default value for "
"the
\"
boost_from_average
\"
parameter in
\"
binary
\"
objective is true.
\n
"
"This may cause significantly different results comparing to the previous versions of LightGBM.
\n
"
"Try to set boost_from_average=false, if your old models produce bad results"
);
// count for positive and negative samples
#pragma omp parallel for schedule(static) reduction(+:cnt_positive, cnt_negative)
for
(
data_size_t
i
=
0
;
i
<
num_data_
;
++
i
)
{
...
...
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