diff --git a/__pycache__/__init__.cpython-36.pyc b/__pycache__/__init__.cpython-36.pyc index 494c0e4..55bdcfd 100644 Binary files a/__pycache__/__init__.cpython-36.pyc and b/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_grid_search/__pycache__/__init__.cpython-36.pyc b/q01_grid_search/__pycache__/__init__.cpython-36.pyc index eed5319..0d73ebd 100644 Binary files a/q01_grid_search/__pycache__/__init__.cpython-36.pyc and b/q01_grid_search/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_grid_search/__pycache__/build.cpython-36.pyc b/q01_grid_search/__pycache__/build.cpython-36.pyc index cac4a0b..e024f00 100644 Binary files a/q01_grid_search/__pycache__/build.cpython-36.pyc and b/q01_grid_search/__pycache__/build.cpython-36.pyc differ diff --git a/q01_grid_search/build.py b/q01_grid_search/build.py index 20c99a1..a6d0e22 100644 --- a/q01_grid_search/build.py +++ b/q01_grid_search/build.py @@ -17,6 +17,11 @@ "max_depth": [40, 20, 10], "max_leaf_nodes": [5, 10, 2]} +#model for tuning the +model = RandomForestClassifier(oob_score=True, random_state=9) # Write your solution here : - +def grid_search(X_train, y_train, model, param_grid, cv = 3): + grid_obj = GridSearchCV(model, param_grid=param_grid,cv=cv) + grid_obj.fit(X_train, y_train) + return grid_obj, grid_obj.cv_results_["params"],grid_obj.cv_results_["mean_test_score"] diff --git a/q01_grid_search/tests/__pycache__/__init__.cpython-36.pyc b/q01_grid_search/tests/__pycache__/__init__.cpython-36.pyc index 31ac328..e768414 100644 Binary files a/q01_grid_search/tests/__pycache__/__init__.cpython-36.pyc and b/q01_grid_search/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_grid_search/tests/__pycache__/test_q01_grid_search.cpython-36.pyc b/q01_grid_search/tests/__pycache__/test_q01_grid_search.cpython-36.pyc index bf1afbe..9da5852 100644 Binary files a/q01_grid_search/tests/__pycache__/test_q01_grid_search.cpython-36.pyc and b/q01_grid_search/tests/__pycache__/test_q01_grid_search.cpython-36.pyc differ diff --git a/q02_fit/__pycache__/__init__.cpython-36.pyc b/q02_fit/__pycache__/__init__.cpython-36.pyc index 97c33cb..aed3593 100644 Binary files a/q02_fit/__pycache__/__init__.cpython-36.pyc and b/q02_fit/__pycache__/__init__.cpython-36.pyc differ diff --git a/q02_fit/__pycache__/build.cpython-36.pyc b/q02_fit/__pycache__/build.cpython-36.pyc index 3d41a62..3ac55b1 100644 Binary files a/q02_fit/__pycache__/build.cpython-36.pyc and b/q02_fit/__pycache__/build.cpython-36.pyc differ diff --git a/q02_fit/build.py b/q02_fit/build.py index fbafb1a..ec83694 100644 --- a/q02_fit/build.py +++ b/q02_fit/build.py @@ -22,6 +22,8 @@ # Write your solution here : - - - +def fit(X_test, y_test): + model = grid.best_estimator_ + model.fit(X_train,y_train) + y_pred = grid.predict(X_test) + return confusion_matrix(y_test,y_pred), classification_report(y_test,y_pred) , accuracy_score(y_test, y_pred) diff --git a/q02_fit/tests/__pycache__/__init__.cpython-36.pyc b/q02_fit/tests/__pycache__/__init__.cpython-36.pyc index 4a01850..e653a05 100644 Binary files a/q02_fit/tests/__pycache__/__init__.cpython-36.pyc and b/q02_fit/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q02_fit/tests/__pycache__/test_q02_fit.cpython-36.pyc b/q02_fit/tests/__pycache__/test_q02_fit.cpython-36.pyc index 413b2fc..683740f 100644 Binary files a/q02_fit/tests/__pycache__/test_q02_fit.cpython-36.pyc and b/q02_fit/tests/__pycache__/test_q02_fit.cpython-36.pyc differ