This file contains 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
%spark.pyspark | |
import csv | |
from io import StringIO | |
import json | |
import sklearn | |
import random | |
import matplotlib | |
matplotlib.use('TkAgg') |
This file contains 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
%spark.pyspark | |
def parse_init_events(game_logs): | |
game_won_by = 0 # 0 for blue, 1 for gold | |
victory_type = 0 # 0 for economy, 1 for military, 2 for snail | |
blue_team_vector = team_data_vector() | |
gold_team_vector = team_data_vector() | |
for log in game_logs: |
This file contains 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
%spark.pyspark | |
class team_data_vector(): | |
def __init__(self): | |
self.num_minion_bots = 0 | |
self.is_queen_bot = 0 # 1 if true, 0 if false | |
self.num_berries_deposited = 0 | |
self.num_kills = 0 | |
self.num_speed_players = 0 | |
self.num_warriors = 0 | |
self.num_gates = 0 |
This file contains 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
%spark | |
val kq_game_logs = myquery966 | |
kq_game_logs.createOrReplaceTempView("df_temp") | |
------------------------------- | |
%spark.pyspark | |
import matplotlib | |
matplotlib.use('Agg') | |
import pandas as pd |