Closed Tanag3r closed 1 year ago
Complete: ` def evalMethod_cross_validate(model,model_params=dict,dataset=pd.DataFrame,target_feature=str,n_splits=int):
try:
X = np.array(dataset.drop(columns=str(target_feature)))
y = np.array(dataset[[str(target_feature)]])
cv = KFold(n_splits=n_splits,shuffle=True,random_state=42)
scores = cross_val_score(estimator=model,fit_params=model_params,X=X,y=y,scoring='neg_root_mean_squared_error',cv=cv,n_jobs=-1)
except Exception as ex:
raise ex
return scores
`
https://github.com/Tanag3r/stratascratch_projects/blob/00969d6a7238c82e30e99e3f6e9077d73a5b7ec9/doordash_delivery_est/doordash_est.ipynb#L1