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_grid_search/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q01_grid_search/__pycache__/build.cpython-36.pyc
Binary file not shown.
9 changes: 8 additions & 1 deletion q01_grid_search/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,11 @@


# Write your solution here :

def grid_search(X_train, y_train, model, param_grid, cv=3):
gridsearch_cv = GridSearchCV(estimator=model, param_grid=param_grid,\
n_jobs=3, cv=cv)
gridsearch_cv.fit(X_train, y_train)
grid_cv_results = gridsearch_cv.cv_results_
param_grid_results = grid_cv_results['params']
param_grid_score = grid_cv_results['mean_test_score']
return gridsearch_cv, param_grid_results, param_grid_score
Binary file modified q01_grid_search/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file not shown.
Binary file modified q02_fit/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q02_fit/__pycache__/build.cpython-36.pyc
Binary file not shown.
10 changes: 7 additions & 3 deletions q02_fit/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@


# Write your solution here :



def fit(X_test, y_test):
rf_best_grid_cv = grid.best_estimator_
y_pred_test = rf_best_grid_cv.predict(X_test)
acc_score = accuracy_score(y_true=y_test, y_pred=y_pred_test)
conf_mat = confusion_matrix(y_true=y_test, y_pred=y_pred_test)
classfn_report = classification_report(y_true=y_test, y_pred=y_pred_test)
return conf_mat, classfn_report, acc_score
Binary file modified q02_fit/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q02_fit/tests/__pycache__/test_q02_fit.cpython-36.pyc
Binary file not shown.