Hlasování

Ensemble Methods in Python

Román de las Heras

Data Scientist, Appodeal

Zeptejte se publika

Zeptejte se publika

Moudrost davu

  • Kolektivní inteligence
  • Velká skupina >= Jeden expert
  • Řešení problémů
  • Rozhodování
  • Inovace
  • Predikce
Ensemble Methods in Python

Majority voting

Vlastnosti

  • Klasifikační problémy
  • Majority Voting: modus
  • Lichý počet klasifikátorů (3+)

Multimodální predikce

Vlastnosti moudrého davu:

  • Různorodost: různé algoritmy nebo datové sady
  • Nezávislost a nízká korelace
  • Využití individuálních znalostí
  • Agregace individuálních predikcí
Ensemble Methods in Python

Hlasovací ensemble v scikit-learn

from sklearn.ensemble import VotingClassifier

clf_voting = VotingClassifier( estimators=[ ('label1', clf_1), ('label2', clf_2), ('labelN', clf_N)])

Vyhodnocení výkonu

# Get the accuracy score 
acc = accuracy_score(y_test, y_pred)
print("Accuracy: {:0.3f}".format(acc))
Accuracy: 0.938
# Create the individual models
clf_knn = KNeighborsClassifier(5)
clf_dt = DecisionTreeClassifier()
clf_lr = LogisticRegression()

# Create voting classifier clf_voting = VotingClassifier( estimators=[ ('knn', clf_knn), ('dt', clf_dt), ('lr', clf_lr)])
# Fit it to the training set and predict clf_voting.fit(X_train, y_train) y_pred = clf_voting.predict(X_test)
Ensemble Methods in Python

Pojďme to vyzkoušet!

Ensemble Methods in Python

Preparing Video For Download...