(self, index)
return ids, values, seq_length, label, seq_mask
:param: index
            return  (ids, values, seq_length, label, seq_mask)
            ids: the ids of fileds
            values: values of fields
            seq_length: the length of historical events
            label: the label of the target payment
            seq_mask: the attention mask
:param: index
            return  (ids, values, seq_length, label, seq_mask)
            ids: the ids of fileds
            values: values of fields
            seq_length: the length of historical events
            label: the label of the target payment
            seq_mask: the attention mask
: param : index return ( ids values seq_length label seq_mask ) ids : the ids of fileds values : values of fields seq_length : the length of historical events label : the label of the target payment seq_mask : the attention mask
def __getitem__(self, index):
        """
            :param: index
            return  (ids, values, seq_length, label, seq_mask)
            ids: the ids of fileds
            values: values of fields
            seq_length: the length of historical events
            label: the label of the target payment
            seq_mask: the attention mask
        """
        line = self.lines[index]
        line = line.strip()
        line = line.split(' ')
        event_id = line.pop(0)
        num_events = int(line.pop(0))
        label = np.array(int(line.pop(0)))
        valid_features = self.nb_features_per_event * self.maxnum_events

        line = line[-valid_features:]
        ids, values = zip(*[x.split(':') for x in line])
        ids = list(ids)
        values = list(values)
        # the id, values of the target payment
        driver_ids = np.array(ids[-self.nb_features_per_event:]).reshape((1, -1))
        driver_values = np.array(values[-self.nb_features_per_event:]).reshape((1, -1))
        # the id, values of the historical events
        detail_ids = np.array(ids[:-self.nb_features_per_event]).reshape((-1, self.nb_features_per_event))
        detail_values = np.array(values[:-self.nb_features_per_event]).reshape((-1, self.nb_features_per_event))

        seq_length = self.maxnum_events - 1

        if num_events < self.maxnum_events - 1:
            seq_length = num_events
            detail_ids = np.concatenate(
                (detail_ids, np.zeros((self.maxnum_events - 1 - seq_length, self.nb_features_per_event))), axis=0)
            detail_values = np.concatenate(
                (detail_values, np.zeros((self.maxnum_events - 1 - seq_length, self.nb_features_per_event))), axis=0)

        if seq_length <= 0:
            seq_length = 1
        seq_length = np.array(seq_length)
        seq_mask = np.zeros(10, dtype='float32')
        seq_mask[seq_length:] = 1
        ids = np.concatenate((detail_ids, driver_ids), axis=0).astype(float).astype('int64')
        values = np.concatenate((detail_values, driver_values), axis=0).astype('float32')
        return ids, values, seq_length, label, seq_mask
def __getitem__ ( self , index ) : line = self . lines [ index ] line = line . strip ( ) line = line . split ( ' ' ) event_id = line . pop ( 0 ) num_events = int ( line . pop ( 0 ) ) label = np . array ( int ( line . pop ( 0 ) ) ) valid_features = self . nb_features_per_event * self . maxnum_events line = line [ - valid_features : ] ids , values = zip ( * [ x . split ( ':' ) for x in line ] ) ids = list ( ids ) values = list ( values ) # the id, values of the target payment driver_ids = np . array ( ids [ - self . nb_features_per_event : ] ) . reshape ( ( 1 , - 1 ) ) driver_values = np . array ( values [ - self . nb_features_per_event : ] ) . reshape ( ( 1 , - 1 ) ) # the id, values of the historical events detail_ids = np . array ( ids [ : - self . nb_features_per_event ] ) . reshape ( ( - 1 , self . nb_features_per_event ) ) detail_values = np . array ( values [ : - self . nb_features_per_event ] ) . reshape ( ( - 1 , self . nb_features_per_event ) ) seq_length = self . maxnum_events - 1 if num_events < self . maxnum_events - 1 : seq_length = num_events detail_ids = np . concatenate ( ( detail_ids , np . zeros ( ( self . maxnum_events - 1 - seq_length , self . nb_features_per_event ) ) ) , axis = 0 ) detail_values = np . concatenate ( ( detail_values , np . zeros ( ( self . maxnum_events - 1 - seq_length , self . nb_features_per_event ) ) ) , axis = 0 ) if seq_length <= 0 : seq_length = 1 seq_length = np . array ( seq_length ) seq_mask = np . zeros ( 10 , dtype = 'float32' ) seq_mask [ seq_length : ] = 1 ids = np . concatenate ( ( detail_ids , driver_ids ) , axis = 0 ) . astype ( float ) . astype ( 'int64' ) values = np . concatenate ( ( detail_values , driver_values ) , axis = 0 ) . astype ( 'float32' ) return ids , values , seq_length , label , seq_mask