(self, row, attr, values)
return tensor
:param row: (namedtuple or dict) current initial values
        :param attr: (str) attribute of row (i.e. cell) the :param values: correspond to
            and the cell to generate a feature tensor for.
        :param values: (list[str]) values to generate

        :return: Tensor with dimensions (len(values), # of features)
:param row: (namedtuple or dict) current initial values
        :param attr: (str) attribute of row (i.e. cell) the :param values: correspond to
            and the cell to generate a feature tensor for.
        :param values: (list[str]) values to generate
: param row : ( namedtuple or dict ) current initial values : param attr : ( str ) attribute of row ( i . e . cell ) the : param values : correspond to and the cell to generate a feature tensor for . : param values : ( list [ str ] ) values to generate
def create_tensor(self, row, attr, values):
        """
        :param row: (namedtuple or dict) current initial values
        :param attr: (str) attribute of row (i.e. cell) the :param values: correspond to
            and the cell to generate a feature tensor for.
        :param values: (list[str]) values to generate

        :return: Tensor with dimensions (len(values), # of features)
        """
        tensor = torch.zeros(len(values), self.num_features())
        for val_idx, val in enumerate(values):
            for other_attr_idx, other_attr in enumerate(self.attrs):
                if attr == other_attr:
                    continue

                other_val = row[other_attr]

                # calculate p(val | other_val)
                # there may not be co-occurrence frequencies for some value pairs since
                # our possible values were from correlation with only
                # one other attribute
                if val == NULL_REPR or other_val == NULL_REPR:
                    fv = NA_COOCCUR_FV
                else:
                    cooccur = self.cooccur_freq[attr][other_attr].get(val, {}).get(other_val, NA_COOCCUR_FV)
                    freq = self.freq[other_attr][row[other_attr]]
                    fv = float(cooccur) / float(freq)

                feat_idx = self.attr_to_idx[attr] * self.n_attrs + other_attr_idx
                tensor[val_idx, feat_idx] = fv
        return tensor
def create_tensor ( self , row , attr , values ) : tensor = torch . zeros ( len ( values ) , self . num_features ( ) ) for val_idx , val in enumerate ( values ) : for other_attr_idx , other_attr in enumerate ( self . attrs ) : if attr == other_attr : continue other_val = row [ other_attr ] # calculate p(val | other_val) # there may not be co-occurrence frequencies for some value pairs since # our possible values were from correlation with only # one other attribute if val == NULL_REPR or other_val == NULL_REPR : fv = NA_COOCCUR_FV else : cooccur = self . cooccur_freq [ attr ] [ other_attr ] . get ( val , { } ) . get ( other_val , NA_COOCCUR_FV ) freq = self . freq [ other_attr ] [ row [ other_attr ] ] fv = float ( cooccur ) / float ( freq ) feat_idx = self . attr_to_idx [ attr ] * self . n_attrs + other_attr_idx tensor [ val_idx , feat_idx ] = fv return tensor