-
Notifications
You must be signed in to change notification settings - Fork 157
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
[ENH] Support customized base estimator and predictor #48
Conversation
Hi @Maryom, this PR implements the feature request on custom base estimators. If you want to use XGBClassifier as the base estimators, below is the example code: from sklearn.datasets import load_digits
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from deepforest import CascadeForestClassifier
from xgboost import XGBClassifier
X, y = load_digits(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=1)
model = CascadeForestClassifier(random_state=1)
# New Steps
estimators = [XGBClassifier() for _ in range(4)] # 4 base estimators per cascade layer
model.set_estimator(estimators)
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
acc = accuracy_score(y_test, y_pred) * 100
print("\nTesting Accuracy: {:.3f} %".format(acc)) You can find the wheels for installation here .Feel free to comment below if you have any problem or suggestion when using this feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Hi @xuyxu I'm really sorry for not being responsive I was sick. Thank you so much for you awesome work 🙏🏼 it is really handy 👌🏼 |
Thanks for reporting @kangwenhao, please refer to #67 for details. |
Thank you for your help. Good luck! |
Hi @kangwenhao, please refer to the API Reference for an introduction on |
resolves #29 #26
Steps
set_estimator
andset_predictor
for the modelCode Snippet