Skip to content

Instantly share code, notes, and snippets.

@audy
Created December 13, 2013 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save audy/7946551 to your computer and use it in GitHub Desktop.
Save audy/7946551 to your computer and use it in GitHub Desktop.
Example of using a Support Vector Machine in place of Decision Trees for the weak learner in Adaptive Boosting
#!/usr/bin/env python
from sklearn.ensemble import AdaBoostClassifier
from sklearn.svm import SVC
from sklearn.datasets import load_iris
from sklearn.cross_validation import cross_val_score
data = load_iris()
features = data['data']
labels = data['target']
estimator = AdaBoostClassifier(base_estimator=SVC(probability=True))
print cross_val_score(estimator, features, labels).mean()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment