Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[python-package] simplify Dataset._compare_params_for_warning() #6120

Merged
merged 2 commits into from
Oct 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions python-package/lightgbm/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2200,8 +2200,8 @@ def __init_from_csc(

@staticmethod
def _compare_params_for_warning(
params: Optional[Dict[str, Any]],
other_params: Optional[Dict[str, Any]],
params: Dict[str, Any],
other_params: Dict[str, Any],
ignore_keys: Set[str]
) -> bool:
"""Compare two dictionaries with params ignoring some keys.
Expand All @@ -2210,9 +2210,9 @@ def _compare_params_for_warning(

Parameters
----------
params : dict or None
params : dict
One dictionary with parameters to compare.
other_params : dict or None
other_params : dict
Another dictionary with parameters to compare.
ignore_keys : set
Keys that should be ignored during comparing two dictionaries.
Expand All @@ -2222,10 +2222,6 @@ def _compare_params_for_warning(
compare_result : bool
Returns whether two dictionaries with params are equal.
"""
if params is None:
params = {}
if other_params is None:
other_params = {}
for k in other_params:
if k not in ignore_keys:
if k not in params or params[k] != other_params[k]:
Expand Down