Skip to content

Instantly share code, notes, and snippets.

Avatar

Udit Saxena udit-saxena

View GitHub Profile
View gist:ef8ba915e7e836561309e55ca014c907
%spark.pyspark
import csv
from io import StringIO
import json
import sklearn
import random
import matplotlib
matplotlib.use('TkAgg')
View gist:c1c8324e5b9268e161478661247955bd
%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:
View gist:c90b13b15a992e45ccb3e408ef0a1e6c
%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
View gist:68abc1120df78f201d960efad679689f
%spark
val kq_game_logs = myquery966
kq_game_logs.createOrReplaceTempView("df_temp")
-------------------------------
%spark.pyspark
import matplotlib
matplotlib.use('Agg')
import pandas as pd
You can’t perform that action at this time.