Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified __pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q01_myXGBoost/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q01_myXGBoost/__pycache__/build.cpython-36.pyc
Binary file not shown.
6 changes: 4 additions & 2 deletions q01_myXGBoost/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
}


# Write your solution here :


def myXGBoost (X_train,X_test, y_train,y_test, model,param_grid,KFold =3, **kwargs ):
clf = GridSearchCV(model, param_grid, cv= KFold, **kwargs)
clf.fit(X_train, y_train)
return accuracy_score(y_test,clf.predict(X_test)), clf.best_params_
Binary file modified q01_myXGBoost/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file not shown.
Binary file modified q02_param2/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q02_param2/__pycache__/build.cpython-36.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions q02_param2/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@


# Write your solution here :
def param2(X_train, X_test, y_train, y_test, model, param_grid2):
return myXGBoost(X_train, X_test, y_train, y_test, model, param_grid2,
colsample_bytree=0.7, subsample=0.8, max_depth=2, min_child_weight=4)
Binary file modified q02_param2/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q02_param2/tests/__pycache__/test_q02_param2.cpython-36.pyc
Binary file not shown.
Binary file modified q03_xgboost/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q03_xgboost/__pycache__/build.cpython-36.pyc
Binary file not shown.
8 changes: 8 additions & 0 deletions q03_xgboost/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@
# Write your solution here :


def xgboost(X_train,X_test,y_train,y_test,**kwargs):
xgb1 = XGBClassifier(seed=9)
if kwargs:
xgb1.set_params(**kwargs)
xgb1.fit(X_train, y_train)
y_pred = xgb1.predict(X_test)
accuracy = accuracy_score(y_pred, y_test)
return accuracy
Binary file modified q03_xgboost/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q03_xgboost/tests/__pycache__/test_q03_xgboost.cpython-36.pyc
Binary file not shown.