From bd692f45441feef4117cbfe5e767bdc915ca55bb Mon Sep 17 00:00:00 2001 From: Thierry Moudiki Date: Wed, 9 Oct 2024 07:24:43 +0000 Subject: [PATCH] remove try to get error --- mlsauce/booster/_booster_classifier.py | 43 ++++++++++++-------------- mlsauce/booster/_booster_regressor.py | 43 ++++++++++++-------------- 2 files changed, 40 insertions(+), 46 deletions(-) diff --git a/mlsauce/booster/_booster_classifier.py b/mlsauce/booster/_booster_classifier.py index e124f1d..fb26667 100644 --- a/mlsauce/booster/_booster_classifier.py +++ b/mlsauce/booster/_booster_classifier.py @@ -411,29 +411,26 @@ def fit(self, X, y, **kwargs): ) X = np.column_stack((X, clustered_X)) - try: - self.obj = boosterc.fit_booster_classifier( - np.asarray(X, order="C"), - np.asarray(y, order="C"), - n_estimators=self.n_estimators, - learning_rate=self.learning_rate, - n_hidden_features=self.n_hidden_features, - reg_lambda=self.reg_lambda, - alpha=self.alpha, - row_sample=self.row_sample, - col_sample=self.col_sample, - dropout=self.dropout, - tolerance=self.tolerance, - direct_link=self.direct_link, - verbose=self.verbose, - seed=self.seed, - backend=self.backend, - solver=self.solver, - activation=self.activation, - obj=self.base_model, - ) - except ValueError: - pass + self.obj = boosterc.fit_booster_classifier( + np.asarray(X, order="C"), + np.asarray(y, order="C"), + n_estimators=self.n_estimators, + learning_rate=self.learning_rate, + n_hidden_features=self.n_hidden_features, + reg_lambda=self.reg_lambda, + alpha=self.alpha, + row_sample=self.row_sample, + col_sample=self.col_sample, + dropout=self.dropout, + tolerance=self.tolerance, + direct_link=self.direct_link, + verbose=self.verbose, + seed=self.seed, + backend=self.backend, + solver=self.solver, + activation=self.activation, + obj=self.base_model, + ) self.n_classes_ = len(np.unique(y)) # for compatibility with sklearn self.n_estimators = self.obj["n_estimators"] diff --git a/mlsauce/booster/_booster_regressor.py b/mlsauce/booster/_booster_regressor.py index d51f5ac..5e5ee4a 100644 --- a/mlsauce/booster/_booster_regressor.py +++ b/mlsauce/booster/_booster_regressor.py @@ -281,29 +281,26 @@ def fit(self, X, y, **kwargs): ) X = np.column_stack((X, clustered_X)) - try: - self.obj = boosterc.fit_booster_regressor( - X=np.asarray(X, order="C"), - y=np.asarray(y, order="C"), - n_estimators=self.n_estimators, - learning_rate=self.learning_rate, - n_hidden_features=self.n_hidden_features, - reg_lambda=self.reg_lambda, - alpha=self.alpha, - row_sample=self.row_sample, - col_sample=self.col_sample, - dropout=self.dropout, - tolerance=self.tolerance, - direct_link=self.direct_link, - verbose=self.verbose, - seed=self.seed, - backend=self.backend, - solver=self.solver, - activation=self.activation, - obj=self.base_model, - ) - except ValueError: - pass + self.obj = boosterc.fit_booster_regressor( + X=np.asarray(X, order="C"), + y=np.asarray(y, order="C"), + n_estimators=self.n_estimators, + learning_rate=self.learning_rate, + n_hidden_features=self.n_hidden_features, + reg_lambda=self.reg_lambda, + alpha=self.alpha, + row_sample=self.row_sample, + col_sample=self.col_sample, + dropout=self.dropout, + tolerance=self.tolerance, + direct_link=self.direct_link, + verbose=self.verbose, + seed=self.seed, + backend=self.backend, + solver=self.solver, + activation=self.activation, + obj=self.base_model, + ) self.n_estimators = self.obj["n_estimators"]