def prob_f(self): dv = self.dict_vectorizer dlr = lambda x, y: dict_list_representation([x], [y]) ff = self.ff_model mod = self.model f = lambda X, Y: mod.predict_proba(ff.transform(dv.transform(dlr(X, Y)).toarray())) return lambda X, Y: map(lambda z: z[1], f(X, Y))[0]
def build_data_representations(self, user_atts, inter_atts): print('Building internal data representations...') print(' Building factor level matrix...') itp = map(lambda x: set(x), zip(*inter_atts)) # transpose and get row sets self.inter_levels = map(lambda x: x if len(filter(lambda y: type(y) == type(''), x)) > 0 else (min(x), max(x)), itp) print(' Building dict list representation...') self.dicts_rep = dict_list_representation(user_atts, inter_atts) print('Done!')
def build_data_representations(self, user_atts, inter_atts): print("Building internal data representations...") print(" Building factor level matrix...") itp = map(lambda x: set(x), zip(*inter_atts)) # transpose and get row sets self.inter_levels = map( lambda x: x if len(filter(lambda y: type(y) == type(""), x)) > 0 else (min(x), max(x)), itp ) print(" Building dict list representation...") self.dicts_rep = dict_list_representation(user_atts, inter_atts) print("Done!")
def prob_f(self): dv = self.dict_vectorizer dlr = lambda x, y: dict_list_representation([x], [y]) mod = self.model f = lambda X, Y: mod.predict_proba(dv.transform(dlr(X, Y)).toarray()) return lambda X, Y: map(lambda z: z[1], f(X, Y))[0]