trajectory数据补0
trajectory
数据补0
到同等长度:
def data_process(data, max_step): """ # fill zero for shot trajectory, and add label :param data: the trajectory data of different length :param max_step: the max step(s,a) length of data; the length of s is 49, the length of a is 1. :param ep: may useful for distinguish labels :return: a list form [features+label] """ full_data = [] for label, features in enumerate(data): # fill zero for shot trajectory, and add label new_fearure = list(map(lambda feature:feature+[0]*(max_step*50-len(feature))+[label], features)) full_data.extend(new_fearure) return np.array(full_data)