Skip to content

Instantly share code, notes, and snippets.

@Muhammad4hmed
Created June 19, 2022 15:35
Show Gist options
  • Save Muhammad4hmed/63d9a2e98e2ac17f006952f4b8945f7c to your computer and use it in GitHub Desktop.
Save Muhammad4hmed/63d9a2e98e2ac17f006952f4b8945f7c to your computer and use it in GitHub Desktop.
from scipy.optimize import minimize
#alloff contains 5 fold prediction on all dataset (avoid data leak)
def min_func(K):
ypredtrain = 0
for a in range(len(alloof)):
ypredtrain += K[a]*alloof[a]
return 1/get_score(tmpdf["score"],ypredtrain)
res = minimize(min_func, [1/len(alloof)]*len(alloof), method='Nelder-Mead', tol=1e-6)
K = res.x
res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment