Skip to content

Commit

Permalink
added warning for early stopping in dart mode
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikerRUS committed Dec 6, 2018
1 parent f55e37d commit 28d1e37
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python-package/lightgbm/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from __future__ import absolute_import

import collections
import warnings
from operator import gt, lt

from .compat import range_
Expand Down Expand Up @@ -179,6 +180,9 @@ def early_stopping(stopping_rounds, verbose=True):
cmp_op = []

def _init(env):
if any((boost_alias in env.params
and env.params[boost_alias] == 'dart') for boost_alias in ('boosting', 'boosting_type', 'boost')):
warnings.warn('Early stopping is not available in dart mode')
if not env.evaluation_result_list:
raise ValueError('For early stopping, '
'at least one dataset and eval metric is required for evaluation')
Expand Down

0 comments on commit 28d1e37

Please sign in to comment.