def buildEventStreamTable(): rows = c.execute(qry).fetchall() c.execute("drop table if exists eventstream") c.execute("""create table eventstream (matchid,halfid,eventtime int, eventname,duel,locationx,locationy,idactor1,teamid,position,eventid)""") logger.map("Building eventstream table", rows, insertRow)
def buildVirtualEventStreamTable(): c.execute("drop table if exists virtualeventstream") c.execute("""create table virtualeventstream (matchid int,halfid int,eventtime int, eventname text,duel int,locationx int,locationy int,idactor1 int,teamid int,position text)""") matchids = [m for (m,) in c.execute("select id from match").fetchall()] logger.map("Building virtualeventstream table", matchids, storeVirtualEventOfMatch)
def search_k_nearest_neighbours(self,window,log=True): f = lambda candidate: (self.dist(window, candidate),candidate) tups = logger.map("Processed NN: ",self.windows,f,log=log,percstep=20) tups.sort(key=lambda tup:tup[0]) #print([t[0] for t in tups]) self.nn = tups[0:self.k] return self.nn