Skip to content

Commit

Permalink
adjustments in catboost and time controller
Browse files Browse the repository at this point in the history
  • Loading branch information
pplonski committed Jan 27, 2021
1 parent ad855c4 commit fafbf8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions supervised/algorithms/catboost.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(self, params):

logger.debug("CatBoostAlgorithm.__init__")

def _assess_iterations(self, X, y, eval_set, max_time):
def _assess_iterations(self, X, y, eval_set, max_time = None):
if max_time is None:
max_time = 3600
try:
Expand All @@ -85,8 +85,8 @@ def _assess_iterations(self, X, y, eval_set, max_time):
verbose_eval=False,
)
elapsed_time = np.round(time.time() - start_time, 2)
new_rounds = int(min(10000, max_time / elapsed_time * 2.0))
new_rounds = max(max_rounds, 100)
new_rounds = int(min(10000, max_time / elapsed_time))
new_rounds = max(max_rounds, 10)
return new_rounds
except Exception as e:
return 1000
Expand Down Expand Up @@ -122,10 +122,9 @@ def fit(
)

# disable for now ...
# new_iterations = self._assess_iterations(X, y, eval_set, max_time)
# self.model.set_params(iterations=new_iterations)

self.model.set_params(iterations=self.rounds)
new_iterations = self._assess_iterations(X, y, eval_set, max_time = None)
self.model.set_params(iterations=new_iterations)
#self.model.set_params(iterations=self.rounds)

self.model.fit(
X,
Expand Down
2 changes: 1 addition & 1 deletion supervised/tuner/time_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def time_should_use(self, fit_level):
"insert_random_feature": 0.05,
"features_selection": 0.05,
"hill_climbing_1": 0.2, # enough to have only first step from hill climbing
"boost_on_errors": 0.1,
"boost_on_errors": 0.05,
"stack": 0.15,
}

Expand Down

0 comments on commit fafbf8c

Please sign in to comment.