diff --git a/__pycache__/__init__.cpython-36.pyc b/__pycache__/__init__.cpython-36.pyc index c105ea6..03974cd 100644 Binary files a/__pycache__/__init__.cpython-36.pyc and b/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_pipeline/__pycache__/__init__.cpython-36.pyc b/q01_pipeline/__pycache__/__init__.cpython-36.pyc index fbce7a1..82b8a57 100644 Binary files a/q01_pipeline/__pycache__/__init__.cpython-36.pyc and b/q01_pipeline/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_pipeline/__pycache__/build.cpython-36.pyc b/q01_pipeline/__pycache__/build.cpython-36.pyc index 46b8551..cc92fef 100644 Binary files a/q01_pipeline/__pycache__/build.cpython-36.pyc and b/q01_pipeline/__pycache__/build.cpython-36.pyc differ diff --git a/q01_pipeline/build.py b/q01_pipeline/build.py index 96beca7..0b2095d 100644 --- a/q01_pipeline/build.py +++ b/q01_pipeline/build.py @@ -1,3 +1,4 @@ +# %load q01_pipeline/build.py import pandas as pd import numpy as np from sklearn.model_selection import train_test_split, GridSearchCV @@ -10,4 +11,31 @@ # Write your solution here : +le = LabelEncoder() +model = RandomForestClassifier(random_state=9,class_weight = 'balanced',n_estimators=50) +for column in bank.select_dtypes(include=['object']).columns.values: + bank[column] = le.fit_transform(bank[column]) + +X=bank.drop(['y'],axis=1) +y=bank['y'] +X_train,X_test,y_train,y_test = train_test_split(X,y,test_size =0.3,random_state=9) + +def pipeline(X_train,X_test,y_train,y_test,model): + param_grid = {'max_depth':[2,3,4,5,6,10,15,20,30],'max_features':[8,10,12,14],'max_leaf_nodes':[2,5,10,15,20]} + + gs = GridSearchCV(estimator=model,param_grid=param_grid) + + obj = gs.fit(X_train,y_train) + + y_pred = gs.predict(X_test) + auc = roc_auc_score(y_test,y_pred) + + # print (obj,auc) + + return obj,auc + +# pipeline(X_train,X_test,y_train,y_test,model) + + + diff --git a/q01_pipeline/tests/__pycache__/__init__.cpython-36.pyc b/q01_pipeline/tests/__pycache__/__init__.cpython-36.pyc index 9a74c78..6d6be4e 100644 Binary files a/q01_pipeline/tests/__pycache__/__init__.cpython-36.pyc and b/q01_pipeline/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_pipeline/tests/__pycache__/test_q01_pipeline.cpython-36.pyc b/q01_pipeline/tests/__pycache__/test_q01_pipeline.cpython-36.pyc index 1a428fb..f1ea17c 100644 Binary files a/q01_pipeline/tests/__pycache__/test_q01_pipeline.cpython-36.pyc and b/q01_pipeline/tests/__pycache__/test_q01_pipeline.cpython-36.pyc differ