def makelabel(): label=[] j=1 final_time="-1" for i in range(1,noofrow): for j in range(i,noofrow+1): if csvlog[i][0]!=csvlog[j][0]: j=j-1 break # considering only those traces which ends with "Send for Credit Collection" if csvlog[j][3]!="Send for Credit Collection": continue # finding last event of hte trace for j in range(i,noofrow): if(j==noofrow-1 or csvlog[j+1][0]!=csvlog[i][0]): break # taking time diffrence between the two timestamp timediff=mydatetime.time_diff(csvlog[i][2],csvlog[j][2]) label.append(timediff) j+=1 maxtime=1 # maxtime stores the the maximum time among all the remaining time for i in label: maxtime=max(i,maxtime) j=0 # normalising the label data for i in label: label[j]=i/maxtime j+=1 return label,maxtime
curr_state.append(csvlog[ii][3]) next_state = curr_state.copy() next_state.append(csvlog[i][3]) event = csvlog[i][3] transition = [curr_state, event, next_state] # seperate feature and label set on the basis of transition for ii in range(len(transitions)): if transitions[ii] == transition: feature_data[ii].append(encodedlist[count]) for j in range(i, noofrow): if (csvlog[j][0] != csvlog[i][0]): j = j - 1 break timediff = mydatetime.time_diff(csvlog[i][2], csvlog[j][2]) label_data[ii].append(timediff) # NB[ii][iii] contains number of transition between ii and iii for ii in range(len(states)): if states[ii] == curr_state: for iii in range(len(states)): if states[iii] == next_state: NB[ii][iii] += 1 count += 1 # converting the number into their possiblity for i in range(len(NB)): sumi = 0 for j in range(len(NB[i])): sumi += NB[i][j]