def test_build(self):
     """
 Test build
 """
     print("\nTest 1: RNNClassifier build")
     model = RNNClassifier(2, input_dim=2, latent_dim=3)
     model.build()
Beispiel #2
0
    def test_build(self):
        """
    Test build
    """
        num_labels = 4
        max_steps = 25

        model = RNNClassifier(num_labels,
                              input_dim=1,
                              latent_dim=20,
                              batch_size=1,
                              max_steps=max_steps,
                              cell_class=BasicNormalTriLCell)
        model.build()
Beispiel #3
0
    def test_build(self):
        """
    Test build
    """
        num_labels = 4
        max_steps = 25
        echo_step = 3
        X, Y = generateEchoData(num_labels, 10000, echo_step)
        X = np.reshape(X, [-1, max_steps, 1])
        Y = np.reshape(Y, [-1, max_steps, 1])
        train_dataset = {'train_iseq': X[:300], 'train_labels': Y[:300]}

        model = RNNClassifier(num_labels,
                              input_dim=1,
                              latent_dim=4,
                              batch_size=1,
                              max_steps=max_steps,
                              seq_class='lstm',
                              cell_class='lstm')
        model.build()
        model.train(train_dataset)

        # Test on validation data
        dataset = {'iseq': X[390:]}
        Ypred = model.sample(dataset)
        print(
            "Preds:",
            list(
                zip(
                    np.squeeze(X[390], axis=1)[:-echo_step],
                    np.argmax(np.exp(Ypred[0].T) /
                              np.sum(np.exp(Ypred[0]), axis=1),
                              axis=0)[echo_step:])))
 def test_init(self):
     """
 Test initialization
 """
     print("\nTest 0: RNNClassifier Initialization")
     RNNClassifier(2, input_dim=1, latent_dim=3)
 def test_build(self):
     """
 Test build
 """
     model = RNNClassifier(2, input_dim=1, hidden_dim=3)
     model.build()
 def test_init(self):
     """
 Test initialization
 """
     print("\nTest 0: Regression initialization")
     RNNClassifier(2, input_dim=1, hidden_dim=3)