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
Bug :AttributeError: can't set attribute #6
Comments
Hi leaphan, Thanks for your interest, but I cannot reproduce your error. |
Thanks for your help! I reproduced the error using python 3.8. I've confirmed that this is caused by the property naming (
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, |
thank u very much,i got the result with your help! |
@all-contributors please add @leaphan for the bug reporting |
I've put up a pull request to add @leaphan! 🎉 |
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.n_features = X.shape
AttributeError: can't set attribute
The text was updated successfully, but these errors were encountered: