<jupyter_start><jupyter_text>使用 Voting Classifier<jupyter_code>from sklearn.ensemble import VotingClassifier
# harding voting: 所有estimator都是平等的
voting_clf = VotingClassifier(estimators=[
    ('log_clf', LogisticRegression(solver='lbfgs')),
    ('svm_clf', SVC(gamma='scale')),
    ('dt_clf', DecisionTreeClassifier())
], voting='hard')
voting_clf.fit(X_train, y_train)
voting_clf.score(X_test, y_test)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13921113689095127, 'fraction_numerical': 0.0, 'mean_word_length': 9.8, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '246371', 'license': 'MIT', 'n_tokens_mistral': 179, 'n_tokens_neox': 175, 'n_words': 22, 'path': 'ml/ensemble/voting-classify.ipynb', 'repo_name': 'tangchunbo/machine-learning', 'size': '431'}