This file contains 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 xgboost import XGBoostClassifier | |
xgb_clf = XGBClassifier() | |
xgb_clf.fit(X, y) |
This file contains 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.ensemble import GradientBoostingRegressor | |
gbrt = GradientBoostingRegressor(max_depth=2, n_estimators=3, learning_rate=1.0, random_state=42) | |
gbrt.fit(X, y) |
This file contains 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.ensemble import AdaBoostClassifier | |
ada_clf = AdaBoostClassifier( | |
DecisionTreeClassifier(max_depth=1), n_estimators=200, | |
algorithm="SAMME.R", learning_rate=0.5, random_state=42) | |
ada_clf.fit(X_train, y_train) |
This file contains 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.ensemble import RandomForestClassifier | |
rnd_clf = RandomForestClassifier(n_estimators=500, max_leaf_nodes=16, n_jobs=-1, random_state=42) | |
rnd_clf.fit(X_train, y_train) | |
y_pred_rf = rnd_clf.predict(X_test) |
This file contains 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
Bootstrap = True, bootstrap_features = True, max_features = 0.6 | |
#max_samples less than 1.0 or discarded |
This file contains 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
bootstrap_features = True, max_samples = 0.6 | |
#max_samples to be less than 1.0 or discard variable |
This file contains 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
bag_clf = BaggingClassifier( | |
DecisionTreeClassifier(random_state=42), n_estimators=500, | |
max_samples=100, bootstrap=True, n_jobs=-1, random_state=42, | |
oob_score = True) |
This file contains 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.ensemble import BaggingClassifier | |
from sklearn.tree import DecisionTreeClassifier | |
bag_clf = BaggingClassifier( | |
DecisionTreeClassifier(random_state=42), n_estimators=500, | |
max_samples=100, bootstrap=True, n_jobs=-1, random_state=42) | |
bag_clf.fit(X_train, y_train) | |
y_pred = bag_clf.predict(X_test) | |
This file contains 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.svm import SVC | |
from sklearn.linear_model import LogisticRegression | |
from sklearn.ensemble import RandomForestClassifier | |
from sklearn.ensemble import VotingClassifier | |
log_clf = LogisticRegression() | |
rnd_clf = RandomForestClassifier() | |
svm_clf = SVC() | |
voting_clf = VotingClassifier( |
NewerOlder