-
Notifications
You must be signed in to change notification settings - Fork 99
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
BaggingClassifier.__init__() got an unexpected keyword argument 'base_estimator' #68
Comments
I ran into the same issue, it seems to stem from sklearn modifying the function parameters. This can be fixed if you go into the code and change "base_estimator" to "estimator". on linux you can do this with: sed -i 's/base_estimator=/estimator=/g' path/to/your/environment/lib/python3.XX/site-packages/skrules/skope_rules.py |
I also encounter with this problem. Can you tell me how to fixed the parameter ("estimator") function or test demo? Thank you very much! |
You have to locate the skope_rules.py file in your python environment (the path to it is usually written in the error message you get when trying to run this function). Open the file in a text editor of your choice and replace every instance of the base_estimator keyword with estimator and save it. This should then allow the code to run as intended. |
Thank you so much. I've done with you help. |
|
Dear Team,
I am running the titanic demo notebook and getting the below error in the code
skope_rules_clf.fit(X_train, y_train)
in SkopeRules.fit(self, X, y, sample_weight)
265 self._max_depths = self.max_depth
266 if isinstance(self.max_depth, Iterable) else [self.max_depth]
268 for max_depth in self.max_depths:
--> 269 bagging_clf = BaggingClassifier(
270 base_estimator=DecisionTreeClassifier(
271 max_depth=max_depth,
272 max_features=self.max_features,
273 min_samples_split=self.min_samples_split),
274 n_estimators=self.n_estimators,
275 max_samples=self.max_samples,
276 max_features=self.max_samples_features,
277 bootstrap=self.bootstrap,
278 bootstrap_features=self.bootstrap_features,
279 # oob_score=... XXX may be added
280 # if selection on tree perf needed.
281 # warm_start=... XXX may be added to increase computation perf.
282 n_jobs=self.n_jobs,
283 random_state=self.random_state,
284 verbose=self.verbose)
286 bagging_reg = BaggingRegressor(
287 base_estimator=DecisionTreeRegressor(
288 max_depth=max_depth,
(...)
300 random_state=self.random_state,
301 verbose=self.verbose)
303 clfs.append(bagging_clf)
TypeError: BaggingClassifier.init() got an unexpected keyword argument 'base_estimator'
The text was updated successfully, but these errors were encountered: