from sklearn.ensemble import VotingClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
# create the individual classifiers
rf_clf = RandomForestClassifier()
lr_clf = LogisticRegression()
svm_clf = SVC()
# create the voting classifier
voting_clf = VotingClassifier(estimators=[('rf', rf_clf), ('lr', lr_clf), ('svm', svm_clf)], voting='hard')
# fit the voting classifier to the training data
voting_clf.fit(X_train, y_train)