Exemplo n.º 1
0
def getpredictions():
    x,teama,teamb = get_goalprob(1,True)
    print(teama)
    max_signal,best_team = merge_signal(teama, teamb)
    peaks = detect_peaks(max_signal,mph=0.003,mpd=11,show=False)
    pred1 = [(x[peak],best_team[peak]) for peak in peaks]
    
    x,teama,teamb = get_goalprob(2,True)
    max_signal,best_team = merge_signal(teama, teamb)
    peaks = detect_peaks(max_signal,mph=0.003,mpd=11,show=False)
    pred2 = [(x[peak],best_team[peak]) for peak in peaks]
    return pred1 + pred2
Exemplo n.º 2
0
def find_peaks(doSmooth=False):
    x = [to_minutes(t) if h==1 else to_minutes(t) + 45
         for t,h in zip(time[start:start+step],half[start:start+step])]
    zipped = list(zip(fcb[start:start+step],
                goalprobdom[start:start+step],
                goalprobother[start:start+step]))
    fcbprob = [a if f == 1 else b for f,a,b in zipped]
    otherprob = [-a if f== 0 else -b for f,a,b in zipped]
    #y = exp_smooth(fcbprob,alpha=0.1) if doSmooth else fcbprob
    y = smooth(fcbprob,beta=4) if doSmooth else fcbprob
    peaks = detect_peaks(y,mph=0.003,mpd=12,show=True)
    print([x[peak] for peak in peaks])
    y = smooth(otherprob,beta=4) if doSmooth else otherprob
    peaks = detect_peaks(y,mph=0.003,mpd=12,show=True,valley=True)
    print([x[peak] for peak in peaks])