forked from LI0131/ai-final-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
export.py
35 lines (29 loc) · 921 Bytes
/
export.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import numpy as np
import pandas as pd
def export(training, testing, model):
'''
inputs:
- training: the training set of plays for the model
- testing: the testing set of plays for the model
- model: the model of interest
output:
- a pandas dataframe as dictated by Kaggle submission guidelines
- https://www.kaggle.com/c/nfl-big-data-bowl-2020/overview/evaluation
'''
plays = [[
f'{i} yards' for i in range(-99, 100, 1)
]]
full_set = np.concatenate([training, testing])
pred = [
model.predict(np.array([instance,])) for instance in full_set
]
for instance in pred:
yardage = []
for i in range(-99, 100, 1):
if i < instance[0]:
yardage.append(0)
else:
yardage.append(1)
plays.append(yardage)
df = pd.DataFrame(plays)
return df