Created
September 15, 2022 16:01
-
-
Save Abhayparashar31/8ec67126131e695fafa86ff93a5b0c1b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.neighbors import KNeighborsClassifier | |
from sklearn.tree import DecisionTreeClassifier | |
from sklearn.svm import SVC | |
from sklearn.linear_model import LogisticRegression | |
from sklearn.ensemble import StackingClassifier | |
base_learners = [ | |
('l1', KNeighborsClassifier()), | |
('l2', DecisionTreeClassifier()), | |
('l3',SVC(gamma=2, C=1))) | |
] | |
model = StackingClassifier(estimators=base_learners, final_estimator=LogisticRegression(),cv=5) | |
model.fit(X_train, y_train) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment