Home Archives Search Feed Football Squares How To Use


PGA BMW Championship: Will H. Matsuyama OR P. Cantlay LEAD (or share the lead) at the END of Round 3?


2:00 PM
Yes: At least 1 leads or shares lead
No: Neither lead or share lead


Inputs Needed to Solve

2018-2019 BMW Championship LeaderBoard

##### User Estimates #####

scores = [69,63,67,66,65,69,69,66,67,68,67,68,67,68,67,68,66,69,68,68,69,67,69,67,70,66,70,66,70,67,66,71,
         70,67,68,69,66,71,67,70,66,72,67,71,71,67,65,73,71,68,75,65,68,71,68,71,70,69,70,69,67,73,70,70,
         67,73,69,71,71,69,71,69,68,72]


## Round 2 Leaders

# Matsuyama and Cantlay are index 0 and 1

golfer_scores = [-12,-11,-10,-9,-9,-9,-9,-9,-9,-8,-8,-8,-7,-7,-7,-7,-7,-7]

Method to Solve

## [1]

import numpy as np
import pandas as pd
score_dist = {}

for s in scores:
    if s-72 in score_dist:
        score_dist[s-72] += 1
    else:
        score_dist[s-72] = 1
        
t=sum(score_dist.values())
for i in score_dist:
    score_dist[i] = float(score_dist[i])/t
    
score_dist
{-9: 0.013513513513513514,
 -7: 0.04054054054054054,
 -6: 0.10810810810810811,
 -5: 0.1891891891891892,
 -4: 0.14864864864864866,
 -3: 0.16216216216216217,
 -2: 0.12162162162162163,
 -1: 0.13513513513513514,
 0: 0.02702702702702703,
 1: 0.04054054054054054,
 3: 0.013513513513513514}
## [2]

outcomes = list(score_dist.keys())
p_outcomes = list(score_dist.values())

yes = 0
iterations = 9999

for i in range(iterations):
    new_scores = []
    for g in golfer_scores:
        g += int(np.random.choice(outcomes,1,p=p_outcomes))
        new_scores.append(g)

    min_index = min((val, idx) for (idx, val) in enumerate(new_scores))[1]
    
    if min_index == 0 or min_index == 1:
        yes += 1
## [3]

p_lead = float(yes)/iterations

Solution

print("The proability H. Matsuyama OR P. Cantlay LEAD (or share the lead) at the END of Round 3 is ~%s" % round(p_lead,3))
The proability H. Matsuyama OR P. Cantlay LEAD (or share the lead) at the END of Round 3 is ~0.706



Info

download markdown file
email: krellabsinc@gmail.com
twitter: @KRELLabs

import sys
print(sys.version)
2.7.12 |Anaconda 4.2.0 (64-bit)| (default, Jun 29 2016, 11:07:13) [MSC v.1500 64 bit (AMD64)]
Posted on 8/17/2019






← Next post    ·    Previous post →