Closed leaphan closed 2 years ago
Hi leaphan,
Thanks for your interest, but I cannot reproduce your error. I completely reinstalled IMBENS from PyPI in my local environment and ran your example code, but nothing happened. This may be caused by the inconsistent python version. I'm using python 3.8.5, it would be helpful for me to locate the error and debug if you can provide more detailed system information, e.g., the version of python and main dependencies like NumPy, scipy, sklearn, etc.
thanks for your reply. i'm using python 3.8
python3.8.8
Thanks for your help! I reproduced the error using python 3.8.
I've confirmed that this is caused by the property naming (n_features_
), which is now depreciated in sklearn
.
This issue should have been fixed by my recent commit.
You can now install from this Github repository:
$ git clone https://github.com/ZhiningLiu1998/imbalanced-ensemble.git
$ cd imbalanced-ensemble
$ pip install .
and EasyEnsemble as well as other bagging-based methods should work well.
Please feel free to contact me if you have any further questions or find any other bugs.
Best, Zhining
Thanks for your help! I reproduced the error using python 3.8.
I've confirmed that this is caused by the property naming (
n_features_
), which is now depreciated insklearn
. This issue should have been fixed by my recent commit. You can now install from this Github repository:$ git clone https://github.com/ZhiningLiu1998/imbalanced-ensemble.git $ cd imbalanced-ensemble $ pip install .
and EasyEnsemble as well as other bagging-based methods should work well.
Please feel free to contact me if you have any further questions or find any other bugs.
Best, Zhining
thank u very much,i got the result with your help!
@all-contributors please add @leaphan for the bug reporting
@ZhiningLiu1998
I've put up a pull request to add @leaphan! :tada:
hello ,when i use the code as follow,the will be some errors, EasyEnsembleClassifier was used
from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split from sklearn.metrics import balanced_accuracy_score from sklearn.ensemble import BaggingClassifier from sklearn.tree import DecisionTreeClassifier from imbalanced_ensemble.ensemble import EasyEnsembleClassifier from collections import Counter
X, y = make_classification(n_classes=2, class_sep=2, weights=[0.1, 0.9], n_informative=3, n_redundant=1, flip_y=0, n_features=20, n_clusters_per_class=1, n_samples=1000, random_state=10) print('Original dataset shape %s' % Counter(y))
Original dataset shape Counter({{1: 900, 0: 100}})
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0) bbc = EasyEnsembleClassifier(random_state=42) bbc.fit(X_train, y_train) EasyEnsembleClassifier(...) y_pred = bbc.predict(X_test) print(y_pred)
Traceback (most recent call last): File "C:/Users/Administrator/PycharmProjects/pythonProject5/test-easy.py", line 16, in
bbc.fit(X_train, y_train)
File "C:\Users\Administrator\PycharmProjects\pythonProject5\venv\lib\site-packages\imbalanced_ensemble\utils_validation.py", line 602, in inner_f
return f(kwargs)
File "C:\Users\Administrator\PycharmProjects\pythonProject5\venv\lib\site-packages\imbalanced_ensemble\ensemble\under_sampling\easy_ensemble.py", line 275, in fit
return self._fit(X, y,
File "C:\Users\Administrator\PycharmProjects\pythonProject5\venv\lib\site-packages\imbalanced_ensemble\utils_validation.py", line 602, in inner_f
return f(kwargs)
File "C:\Users\Administrator\PycharmProjects\pythonProject5\venv\lib\site-packages\imbalanced_ensemble\ensemble_bagging.py", line 359, in _fit
n_samples, self.nfeatures = X.shape
AttributeError: can't set attribute