This file contains hidden or 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
| date_col | home | away | score | points | home-adv | referee | opponent | PI | |
|---|---|---|---|---|---|---|---|---|---|
| 2018-08-12 | arsenal | manchester city | 0–2 | 0 | 1 | Michael Oliver | manchestercity | 1.3102245221600866 | |
| 2018-08-18 | chelsea | arsenal | 3–2 | 0 | 0 | Martin Atkinson | chelsea | 1.095206298862087 | |
| 2018-08-25 | arsenal | west ham united | 3–1 | 3 | 1 | Graham Scott | westhamunited | 0.8275324819853656 | |
| 2018-09-02 | cardiff city | arsenal | 2–3 | 3 | 0 | Anthony Taylor | cardiffcity | 0.5715382689257991 | |
| 2018-09-15 | newcastle united | arsenal | 1–2 | 3 | 0 | Lee Probert | newcastleunited | 0.7149987480176946 | |
| 2018-09-23 | arsenal | everton | 2–0 | 3 | 1 | Jonathan Moss | everton | 0.8625768578026318 | |
| 2018-09-29 | arsenal | watford | 2–0 | 3 | 1 | Anthony Taylor | watford | 0.5499707870795425 | |
| 2018-10-07 | fulham | arsenal | 1–5 | 3 | 0 | Paul Tierney | fulham | 0.4290960687755612 | |
| 2018-10-22 | arsenal | leicester city | 3–1 | 3 | 1 | Chris Kavanagh | leicestercity | 0.9565589961884093 |
This file contains hidden or 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
| ds | home-adv | referee_Anthony Taylor | referee_Jonathan Moss | referee_Martin Atkinson | referee_Michael Oliver | referee_Mike Dean | cum_pts_preds | ||
|---|---|---|---|---|---|---|---|---|---|
| 0 | 2021-08-15 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | |
| 1 | 2021-08-22 | 1 | 1 | 0 | 0 | 0 | 1 | 1 | |
| 2 | 2021-08-29 | 0 | 0 | 1 | 0 | 0 | 0 | 4 | |
| 3 | 2021-09-05 | 1 | 0 | 0 | 0 | 1 | 0 | 5 | |
| 4 | 2021-09-12 | 1 | 1 | 0 | 0 | 0 | 0 | 6 |
This file contains hidden or 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
| ds | home-adv | cum_pts_preds | ||
|---|---|---|---|---|
| 0 | 2021-08-15 | 0 | 0 | |
| 1 | 2021-08-22 | 1 | 0 | |
| 2 | 2021-08-29 | 0 | 3 | |
| 3 | 2021-09-05 | 1 | 7 | |
| 4 | 2021-09-12 | 1 | 7 |
This file contains hidden or 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
| ds | pts | |
|---|---|---|
| 2021-08-15 | 0 | |
| 2021-08-22 | 0 | |
| 2021-08-29 | 3 | |
| 2021-09-05 | 6 | |
| 2021-09-12 | 6 |
This file contains hidden or 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 transformers import AutoTokenizer, TFAutoModelForSequenceClassification | |
| import tensorflow as tf | |
| model_name = 'bert-base-cased' | |
| tokenizer = AutoTokenizer.from_pretrained(model_name) | |
| model = TFAutoModelForSequenceClassification.from_pretrained(model_name, num_labels=2) | |
| texts = ["I'm a positive example!", "I'm a negative example!"] | |
| labels = [1, 0] |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
| <html> | |
| <head><meta charset="utf-8" /></head> | |
| <body> | |
| <div> <script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script> | |
| <script type="text/javascript">/** | |
| * plotly.js v2.2.0 | |
| * Copyright 2012-2021, Plotly, Inc. | |
| * All rights reserved. | |
| * Licensed under the MIT license | |
| */ |
This file contains hidden or 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
| def pro_df(df, team): | |
| """ | |
| Function to get the date, home-team, away-team, points, referee and score etc | |
| """ | |
| df['date'] = [x[0] for x in df[0]] | |
| df['home'] = [x[1].lower() for x in df[0]] | |
| df['score'] = [x[2] for x in df[0]] | |
| df['away'] = [x[3].lower() for x in df[0]] | |
| df['referee'] = [(' ').join(x[4].split(' ')[-2:]) for x in df[1]] |
This file contains hidden or 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
| preds = model.predict(x_test) | |
| col = [] | |
| aut = [] | |
| for i in range(0, preds[0].shape[0]): | |
| col.append(np.argmax(preds[0][i])) | |
| aut.append(np.argmax(preds[1][i])) | |
| re_map1 = {} | |
| for k, v in map_1.items(): | |
| re_map1[v] = k | |
| re_map2 = {} |
This file contains hidden or 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
| dir_2 = 'working/' | |
| test_list = [] | |
| for file in os.listdir(dir_2): | |
| if file.split('.')[1] != 'ipynb': | |
| json_dict = {} | |
| img_arr = cv2.imread(os.path.join(dir_2, file))[...,::-1] #convert BGR to RGB format | |
| resized_arr = cv2.resize(img_arr, (img_size, img_size)) # Reshaping images to preferred size | |
| json_dict['image'] = resized_arr | |
| test_list.append(json_dict) | |
| test = np.array(test_list) |
This file contains hidden or 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
| inputs = tf.keras.layers.Input(shape=[128, 128, 3], name='main_input') | |
| main_branch = hub.KerasLayer("https://tfhub.dev/google/imagenet/mobilenet_v2_075_128/classification/5")(inputs) | |
| main_branch = tf.keras.layers.Flatten()(main_branch) | |
| main_branch = tf.keras.layers.Dense(1024, activation='relu')(main_branch) | |
| colour_branch = tf.keras.layers.Dense(c_1, activation='softmax', name='colour_output')(main_branch) | |
| auto_branch = tf.keras.layers.Dense(c_2, activation='softmax', name='auto_output')(main_branch) | |
| model = tf.keras.Model(inputs = inputs, | |
| outputs = [colour_branch, auto_branch]) | |
| model.compile(optimizer='rmsprop', |