def test_simple_mlp_with_embedding(self):
    input_size = self.ds_tr.x.shape[1]
    df_tr = self.ds_tr.to_df()
    embedding_module = Embedding([11, 11], embedding_dropout=0.1)
    ann_model = MultiLayerPeceptron(input_size, ann_structure=[2, 1], embedding_module=embedding_module, dropout=0.1)
    ann_model.apply(xavier_init_uniform)
    learn = Learner(self.db, ann_model, loss_func=torch.nn.MSELoss())
    (y_hat, _) = dev_to_np(learn.get_preds(DatasetType.Train))
    e_init = mse(df_tr.target, y_hat)
    learn.fit(1)
    (y_hat, _) = dev_to_np(learn.get_preds(DatasetType.Train))
    e_end = mse(df_tr.target, y_hat)
    self.assertLess(e_end, e_init)
def test_simple_mlp_with_embedding(self):
    input_size = self.ds_tr.x.shape[1]
    df_tr = self.ds_tr.to_df()
    embedding_module = Embedding([11, 11], embedding_dropout=0.1)
    ann_model = MultiLayerPeceptron(input_size, ann_structure=[2, 1], embedding_module=embedding_module, dropout=0.1)
    ann_model.apply(xavier_init_uniform)
    learn = Learner(self.db, ann_model, loss_func=torch.nn.MSELoss())
    (y_hat, _) = dev_to_np(learn.get_preds(DatasetType.Train))
    e_init = mse(df_tr.target, y_hat)
    learn.fit(1)
    (y_hat, _) = dev_to_np(learn.get_preds(DatasetType.Train))
    e_end = mse(df_tr.target, y_hat)
    self.assertLess(e_end, e_init)