Zhining,
Sorry to bother you, but when I use EasyEnsembleClassifier in imbens.ensemble, I got the error "AttributeError: 'Pipeline' object has no attribute '_check_fit_params'", I can't figure out why this happened, could u please help me with it, the code is as follows:
from imbens.ensemble import EasyEnsembleClassifier
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
easyens = EasyEnsembleClassifier(**init_kwargs1).fit(X_train, y_train)
pred = easyens.predict(X_valid)
The errors are as follows:
Traceback (most recent call last):
File "f:\MYT\EEGP\smote_compare.py", line 176, in
easyens = EasyEnsembleClassifier(init_kwargs1).fit(X_train, y_train)
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\imbens\utils_validation.py", line 604, in inner_f
return f(kwargs)
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\imbens\ensemble_under_sampling\easy_ensemble.py", line 285, in fit
return self._fit(
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\imbens\utils_validation.py", line 604, in inner_f
return f(kwargs)
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\imbens\ensemble_bagging.py", line 480, in _fit
all_results = Parallel(
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\sklearn\utils\parallel.py", line 67, in call
return super().call(iterable_with_config)
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\joblib\parallel.py", line 1863, in call
return output if self.return_generator else list(output)
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\joblib\parallel.py", line 1792, in _get_sequential_output
res = func(*args, *kwargs)
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\sklearn\utils\parallel.py", line 129, in call
return self.function(args, kwargs)
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\imbens\ensemble_bagging.py", line 163, in _parallel_build_estimators
estimator.fit((X[indices])[:, features], y[indices])
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\imbens\pipeline.py", line 273, in fit
fit_params_steps = self._check_fit_params(**fit_params)
AttributeError: 'Pipeline' object has no attribute '_check_fit_params'
Zhining, Sorry to bother you, but when I use EasyEnsembleClassifier in imbens.ensemble, I got the error "AttributeError: 'Pipeline' object has no attribute '_check_fit_params'", I can't figure out why this happened, could u please help me with it, the code is as follows:
from imbens.ensemble import EasyEnsembleClassifier from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier
X, y = make_classification(n_classes=2, class_sep=2, n_features=100, weights=[0.3,0.7], n_informative=2, n_redundant=1, flip_y=0.01, n_clusters_per_class=1, n_samples=10000, random_state=10) X_train, X_valid, y_train, y_valid = train_test_split(X, y, test_size=0.5, random_state=42)
init_kwargs1 = {'estimator': DecisionTreeClassifier(),}
easyens = EasyEnsembleClassifier(**init_kwargs1).fit(X_train, y_train) pred = easyens.predict(X_valid)
The errors are as follows:
Traceback (most recent call last): File "f:\MYT\EEGP\smote_compare.py", line 176, in
easyens = EasyEnsembleClassifier(init_kwargs1).fit(X_train, y_train)
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\imbens\utils_validation.py", line 604, in inner_f
return f(kwargs)
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\imbens\ensemble_under_sampling\easy_ensemble.py", line 285, in fit
return self._fit(
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\imbens\utils_validation.py", line 604, in inner_f
return f(kwargs)
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\imbens\ensemble_bagging.py", line 480, in _fit
all_results = Parallel(
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\sklearn\utils\parallel.py", line 67, in call
return super().call(iterable_with_config)
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\joblib\parallel.py", line 1863, in call
return output if self.return_generator else list(output)
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\joblib\parallel.py", line 1792, in _get_sequential_output
res = func(*args, *kwargs)
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\sklearn\utils\parallel.py", line 129, in call
return self.function(args, kwargs)
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\imbens\ensemble_bagging.py", line 163, in _parallel_build_estimators
estimator.fit((X[indices])[:, features], y[indices])
File "D:\ProgramData\anaconda3\envs\EEG\lib\site-packages\imbens\pipeline.py", line 273, in fit
fit_params_steps = self._check_fit_params(**fit_params)
AttributeError: 'Pipeline' object has no attribute '_check_fit_params'
packages version: scikit-learn 1.4.0 imbalanced-ensemble 0.2.1