def train_predict_pool(cls, args): X, y, tr, ts, textModel_params = args params = TextModel.params() textModel_params = {k: v for k, v in textModel_params.items() if k in params} t = TextModel([X[x] for x in tr], **textModel_params) m = cls(t).fit([t[X[x]] for x in tr], [y[x] for x in tr]) return ts, np.array(m.predict([t[X[x]] for x in ts]))
def train_predict_pool(cls, args): X, y, tr, ts, textModel_params = args params = TextModel.params() textModel_params = { k: v for k, v in textModel_params.items() if k in params } t = TextModel([X[x] for x in tr], **textModel_params) m = cls(t).fit([t[X[x]] for x in tr], [y[x] for x in tr]) return ts, np.array(m.predict([t[X[x]] for x in ts]))
def clean_params(kw): params = TextModel.params() return {k: v for k, v in kw.items() if k in params}