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
import numpy as np |
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
import numpy as np |
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
import lightgbm as lgb | |
lgb_train = lgb.Dataset(X_train, y_train) | |
lgb_eval = lgb.Dataset(X_test, y_test, reference=lgb_train) | |
params = {'boosting_type': 'gbdt', | |
'objective': 'binary', | |
'num_leaves': 40, | |
'learning_rate': 0.1, | |
'feature_fraction': 0.9 | |
} | |
gbm = lgb.train(params, |
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
import xgboost as xgb | |
params = {"objective":"binary:logistic",'colsample_bytree': 0.3,'learning_rate': 0.1, | |
'max_depth': 5, 'alpha': 10} | |
model = xgb.XGBClassifier(**params) | |
model.fit(X_train, y_train) | |
model.fit(X_train, y_train) | |
model.score(X_test,y_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.ensemble import AdaBoostClassifier | |
model = AdaBoostClassifier(n_estimators=100) | |
model.fit(X_train, y_train) | |
model.score(X_test,y_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
# Load the dataset | |
data = load_iris() | |
X, y = data.data, data.target | |
# Split the data into training and testing sets | |
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) | |
# Define base classifiers | |
base_classifiers = [ | |
RandomForestClassifier(n_estimators=100, random_state=42), |
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 BaggingRegressor | |
bagging = BaggingRegressor(DecisionTreeRegressor()) | |
bagging.fit(X_train, y_train) | |
model.score(X_test,y_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
bagging.fit(X_train, y_train) | |
bagging.score(X_test,y_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.ensemble import BaggingClassifier | |
from sklearn.tree import DecisionTreeClassifier | |
bagging = BaggingClassifier(base_estimator=DecisionTreeClassifier(),n_estimators=10, max_samples=0.5, max_features=0.5) |
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
lanes_districts = gpd.sjoin(districts, bike_lane, how='inner', predicate='intersects') | |
lanes_districts |
NewerOlder