Skip to content

Commit

Permalink
removed deprecated code (microsoft#3073)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikerRUS authored and ChipKerchner committed Jun 10, 2020
1 parent 23da369 commit be9e5f0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 37 deletions.
34 changes: 2 additions & 32 deletions python-package/lightgbm/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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

Expand Down Expand Up @@ -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 = """more than one metric available, picking one to plot."""
msg = "More than one metric available, picking one to plot."
warnings.warn(msg, stacklevel=2)
metric, results = metrics_for_one.popitem()
else:
Expand Down Expand Up @@ -471,9 +471,6 @@ def add(root, total_count, parent=None, decision=None):


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.
Expand Down Expand Up @@ -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:
Expand All @@ -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.
Expand Down Expand Up @@ -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')
Expand Down
5 changes: 0 additions & 5 deletions src/objective/binary_objective.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit be9e5f0

Please sign in to comment.