-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow_stores.py
62 lines (50 loc) · 1.76 KB
/
show_stores.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from datetime import datetime, timedelta
import textwrap
from utils.prepare_feast import create_fs
def main():
fs = create_fs()
PLAYER_ID1 = "01C"
PLAYER_ID2 = "EKS"
query = f"""\
SELECT DISTINCT * FROM
(
SELECT player_id, ts FROM stats WHERE player_id in ('{PLAYER_ID1}', '{PLAYER_ID2}')
UNION SELECT player_id, ts FROM payments WHERE player_id in ('{PLAYER_ID1}', '{PLAYER_ID2}')
) res
"""
query = textwrap.dedent(query)
print()
print("----------------------HIST DATA FRAME----------------------")
print(query)
training_df = fs.get_historical_features(
entity_df=query,
features=[
"payments:amount",
"payments:transactions",
"stats:win_loss_ratio",
"stats:games_played",
"stats:time_in_game",
]
).to_df()
print()
print("----------------------OFFLINE DATA FRAME PLAYER1----------------------")
print(training_df[training_df["player_id"] == PLAYER_ID1])
print()
print("----------------------OFFLINE DATA FRAME PLAYER2----------------------")
print(training_df[training_df["player_id"] == PLAYER_ID2])
entity_rows = [{"player_id": PLAYER_ID1}, {"player_id": PLAYER_ID2}]
online_df = fs.get_online_features(
features=[
"payments:amount",
"payments:transactions",
"stats:win_loss_ratio",
"stats:games_played",
"stats:time_in_game",
],
entity_rows=entity_rows
).to_df()
print()
print("----------------------ONLINE DATA FRAME----------------------")
print(online_df[["player_id", "amount", "transactions", "win_loss_ratio", "games_played", "time_in_game"]])
if __name__ == "__main__":
main()