Skip to content

Commit

Permalink
fix max_iter and self.max_iter
Browse files Browse the repository at this point in the history
  • Loading branch information
jckkvs authored Jan 27, 2023
1 parent 5c48bf6 commit 71e3395
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions rulefit/rulefit.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,10 @@ def __init__(
self.cv=cv
self.tol=tol
# LassoCV default max_iter is 1000 while LogisticRegressionCV 100.
self.max_iter=1000 if 'regress' else 100
if max_iter is None:
self.max_iter=1000 if 'regress' else 100
else:
self.max_iter = max_iter
self.n_jobs=n_jobs
self.Cs=Cs

Expand All @@ -389,18 +392,7 @@ def fit(self, X, y=None, feature_names=None):
self.tree_generator =GradientBoostingClassifier(n_estimators=n_estimators_default, max_leaf_nodes=self.tree_size, learning_rate=self.memory_par,subsample=self.sample_fract_,random_state=self.random_state,max_depth=100)
else:
# delete (initialize) attribute of learned tree_generator
delete_attributes_ = ["feature_importances_",
"oob_improvement_",
"train_score_",
"loss_",
"init_",
"estimators_",
"n_estimators_",
"n_features_in_",
"feature_names_in_",
"max_features_",
"classes_",
"n_classes_"
delete_attributes_ = [ "estimators_",
]
for attribute in delete_attributes_:
if hasattr(self.tree_generator, attribute):
Expand Down

0 comments on commit 71e3395

Please sign in to comment.