Пример #1
0
    def __init__(self, config, data_seq_list, opt_method):
        self.config = config
        self.data_seq_list = data_seq_list
        self.opt_method = opt_method

        if opt_method.lower() == 'adam':
            self.config.pre_compute_data_var = False

        # if wb.is_linux():
        #     self.feats = feat.FastFeats(self.config.feat_dict)
        # else:
        self.feats = feat.Feats(self.config.feat_dict)

        self.update_op = None
        self.data_exp = None
        self.data_var = None
Пример #2
0
    def __init__(self, config, data, opt_method):
        self.config = config
        self.data = data
        self.opt_method = opt_method

        if opt_method.lower() == 'adam':
            self.config.pre_compute_data_var = False

        # self.len_factor = self.config.pi_true / self.config.pi_0

        wftype, cftype = feat.separate_type(feat.read_feattype_file(self.config.feat_type_file))
        if self.data.word_to_class is not None:
            wftype.update(cftype)

        # if wb.is_linux():
        #     self.feat = feat.FastFeats(wftype)
        # else:
        self.feat = feat.Feats(wftype)

        self.update_op = None
        self.data_exp = None
        self.data_var = None
Пример #3
0
    def __init__(self, config, data_seq_list, opt_method):
        self.config = config
        self.data_seq_list = data_seq_list
        self.opt_method = opt_method

        # tag features
        # if wb.is_linux():
        #     self.feats = feat.FastFeats(self.config.feat_dict)
        # else:
        self.feats = feat.Feats(self.config.feat_dict)

        # update
        self.update_op = None

        # save the trans_matrix
        self.trans_matrix = np.zeros(
            [self.config.tag_size**(self.get_order() - 1)] * 2)
        self.trans_matrix_tail = np.zeros_like(
            self.trans_matrix)  # the trans_matrix at the last position
        self.need_update_trans_matrix = True  # if true, then recompute the trans_matrix

        # used to compute the get_exp()
        self.tag_map_ids = None
        self.tag_map_ids_extra = None
Пример #4
0
 def __str__(self):
     max_order = feat.Feats(self.feat_dict).get_order()
     return 'mix{}g'.format(max_order)