INNER CODE UNIT · Python
Calc_Weights
lzz19980125/awesome-time-series-segmentation-papers · DASSA-master/dassa.py:253
def Calc_Weights(G,maxpath):
Weight = []
for i in range(0,len(maxpath)-1):
for (x,t1,t2,t3,y) in G[maxpath[i]]:
if (x == maxpath[i+1]):
Weight.append(y)
return Weight
def ReadData(data_dir):
print('ReadData')
PFile = data_dir + 'P_Xtilde_Y.txt'
P_Xtilde_Y = []
with open(PFile) as f:
Rows=f.read().splitlines()
for row in Rows:
#items=row.strip().split('\t')
items=row.strip().split()