def mturk_test(): embedding_dim = 300 Y = get_mturk_outcomes() Y = (Y - np.mean(Y, axis=0)) / np.std(Y, axis=0) X = np.load('../data/mturk_embedded.npz') # X0 = X['arr_0'] # X1 = X['arr_1'] X2 = X['arr_2'] # X3 = X['arr_3'] m = SWEM(embedding_dimension=embedding_dim, num_outputs=2, learning_rate=1e-4, activation_fn=tf.nn.elu, embedding_mlp_depth=2, prediction_mlp_layers=(120, 24)) # m.train(X0, Y, plotfile='../img/X0_training.png') m.train(X2, Y[:, :2], plotfile='../img/X2_Y01_training.png', batch_size=100, epochs=20) # m.train(X2, Y, plotfile='../img/X2_training.png')
def random_noise_test(): embedding_dim = 300 data_size = 1000 X = [ np.random.randn(np.random.randint(10, 100), embedding_dim) for i in range(data_size) ] Y = .2 * np.random.randn(data_size) + .5 m = SWEM(embedding_dimension=embedding_dim) m.train(X, Y, plotfile='../img/test_training.png')