Created
June 19, 2022 15:35
-
-
Save Muhammad4hmed/63d9a2e98e2ac17f006952f4b8945f7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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