Example #1
0
def total_accurate_shots_v_points_correlation():
    data = get_plot_data('midfielders', 'total_shots', 'points')
    total_shots_data = data['total_shots']
    points = data['points']
    shot_accuracy_data = get_plot_data('midfielders', 'shot_accuracy', 'points')['shot_accuracy']
    accurate_shots = [total_shots_data[i]*shot_accuracy_data[i] for i in range(len(total_shots_data))]
    r = pearsonr(accurate_shots, points)
    return r
Example #2
0
def total_accurate_shots_v_price_correlation():
    data = get_plot_data('forwards', 'total_shots', 'price')
    total_shots_data = data['total_shots']
    price = data['price']
    shot_accuracy_data = get_plot_data('forwards', 'shot_accuracy', 'price')['shot_accuracy']
    accurate_shots = [total_shots_data[i]*shot_accuracy_data[i] for i in range(len(total_shots_data))]
    r = pearsonr(accurate_shots, price)
    return r
Example #3
0
def combined_score_v_price_correlation():
    data = get_plot_data('midfielders', 'total_shots', 'price')
    total_shots_data = data['total_shots']
    price = data['price']
    shot_accuracy_data = get_plot_data('midfielders', 'shot_accuracy', 'points')['shot_accuracy']
    chances_created_data = get_plot_data('midfielders', 'chances_created', 'points')['chances_created']
    combined_score = [total_shots_data[i]*shot_accuracy_data[i]+0.33*chances_created_data[i] for i in range(len(total_shots_data))]
    r = pearsonr(combined_score, price)
    return r
Example #4
0
def get_forwards_sorted_by_total_score():
    """
    Score is defined as total accurate shots
    :return:
    """
    data = get_plot_data('forwards', 'total_shots', 'name')
    total_shots_data = data['total_shots']
    players = data['name']
    shot_accuracy_data = get_plot_data('forwards', 'shot_accuracy', 'points')['shot_accuracy']
    scores = [total_shots_data[i]*shot_accuracy_data[i] for i in range(len(total_shots_data))]
    player_scores = [(players[i], scores[i]) for i in range(len(players))]

    player_scores = sorted(player_scores, key=lambda x: x[1], reverse=True)
    print(player_scores)
Example #5
0
def get_midfielders_sorted_by_total_score():
    """
    Score is defined as total accurate shots + key passes
    :return:
    """
    data = get_plot_data('midfielders', 'total_shots', 'name')
    total_shots_data = data['total_shots']
    players = data['name']
    shot_accuracy_data = get_plot_data('midfielders', 'shot_accuracy', 'points')['shot_accuracy']
    chances_created_data = get_plot_data('midfielders', 'chances_created', 'points')['chances_created']
    scores = [total_shots_data[i]*shot_accuracy_data[i]+0.33*chances_created_data[i] for i in range(len(total_shots_data))]
    player_scores = [(players[i], scores[i]) for i in range(len(players))]

    player_scores = sorted(player_scores, key=lambda x: x[1], reverse=True)
    print(player_scores)
Example #6
0
def get_forwards_sorted_by_value():
    """
    Value is defined as score per price
    :return:
    """
    data = get_plot_data('forwards', 'total_shots', 'name')
    total_shots_data = data['total_shots']
    players = data['name']
    data = get_plot_data('forwards', 'shot_accuracy', 'price')
    shot_accuracy_data = data['shot_accuracy']
    prices = data['price']
    values = [(total_shots_data[i]*shot_accuracy_data[i])/prices[i] for i in range(len(total_shots_data))]
    player_values = [(players[i], values[i], prices[i]) for i in range(len(players))]

    player_values = sorted(player_values, key=lambda x: x[1], reverse=True)
    print(player_values)
Example #7
0
def shot_accuracy_v_points_correlation():
    data = get_plot_data('forwards', 'shot_accuracy', 'points')
    r = pearsonr(data['shot_accuracy'], data['points'])
    return r
Example #8
0
def attack_score_v_price_correlation():
    data = get_plot_data('forwards', 'total_shots', 'price')
    r = pearsonr(data['total_shots'], data['price'])
    return r
__author__ = 'gj'

from bokeh.plotting import figure, output_file, show

from utils.read_data import get_plot_data

data = get_plot_data('forwards', 'total_shots', 'points')
total_shots_data = data['total_shots']
points = data['points']
shot_accuracy_data = get_plot_data('shot_accuracy', 'points')['shot_accuracy']
accurate_shots = [total_shots_data[i]*shot_accuracy_data[i] for i in range(len(total_shots_data))]
output_file("total_accurate_shots_v_points_scatter.html")
p = figure(plot_width=600, plot_height=600)
p.circle(accurate_shots, points, size=20, color="navy", alpha=0.5)
show(p)
__author__ = 'gj'

from bokeh.plotting import figure, output_file, show

from utils.read_data import get_plot_data

data = get_plot_data('forwards', 'attack_score', 'points')
output_file("attack_score_v_points_scatter.html")
p = figure(plot_width=600, plot_height=600)
p.circle(data['attack_score'], data['points'], size=20, color="navy", alpha=0.5)
show(p)
__author__ = 'gj'

from bokeh.plotting import figure, output_file, show

from utils.read_data import get_plot_data

data = get_plot_data('forwards', 'shot_accuracy', 'points')
output_file("shot_accuracy_v_points_scatter.html")
p = figure(plot_width=600, plot_height=600)
p.circle(data['shot_accuracy'], data['points'], size=20, color="navy", alpha=0.5)
show(p)
__author__ = 'gj'

from bokeh.plotting import figure, output_file, show

from utils.read_data import get_plot_data

data = get_plot_data('forwards', 'total_shots', 'points')
output_file("total_shots_v_points_scatter.html")
p = figure(plot_width=600, plot_height=600)
p.circle(data['total_shots'], data['points'], size=20, color="navy", alpha=0.5)
show(p)
Example #13
0
def chances_created_v_points_correlation():
    data = get_plot_data('midfielders', 'chances_created', 'points')
    r = pearsonr(data['chances_created'], data['points'])
    return r
Example #14
0
def key_passes_v_points_correlation():
    data = get_plot_data('midfielders', 'key_passes', 'points')
    r = pearsonr(data['key_passes'], data['points'])
    return r
Example #15
0
def total_shots_v_points_correlation():
    data = get_plot_data('forwards', 'total_shots', 'points')
    r = pearsonr(data['total_shots'], data['points'])
    return r
Example #16
0
def shots_inside_box_v_price_correlation():
    data = get_plot_data('forwards', 'shots_inside_box', 'price')
    r = pearsonr(data['shots_inside_box'], data['price'])
    return r
__author__ = 'gj'

from bokeh.plotting import figure, output_file, show

from utils.read_data import get_plot_data

data = get_plot_data('midfielders', 'total_shots', 'points')
total_shots_data = data['total_shots']
points = data['points']
shot_accuracy_data = get_plot_data('midfielders', 'shot_accuracy', 'points')['shot_accuracy']
key_passes_data = get_plot_data('midfielders', 'key_passes', 'points')['key_passes']
combined_score = [total_shots_data[i]*shot_accuracy_data[i]+0.33*key_passes_data[i] for i in range(len(total_shots_data))]
output_file("combined_score_v_points_scatter.html")
p = figure(plot_width=600, plot_height=600)
p.circle(combined_score, data['points'], size=20, color="navy", alpha=0.5)
show(p)
Example #18
0
def attack_score_v_points_correlation():
    data = get_plot_data('forwards', 'attack_score', 'points')
    r = pearsonr(data['attack_score'], data['points'])
    return r
Example #19
0
def shots_inside_box_v_points_correlation():
    data = get_plot_data('midfielders', 'shots_inside_box', 'points')
    r = pearsonr(data['shots_inside_box'], data['points'])
    return r