Esempio n. 1
0
def test_equivalence_GSFA_PCA_for_DT_0():
    """ Test of iGSFA and PCA when delta_threshold is smaller than 0.0
    """
    x = numx.random.normal(size=(300, 15))

    n = iGSFANode(output_dim=5, slow_feature_scaling_method=None,
                  delta_threshold=0.0)
    n.train(x, train_mode="regular")
    # n.stop_training() has been automatically called

    y = n.execute(x)
    deltas_igsfa = comp_delta(y)

    n2 = mdp.nodes.PCANode(output_dim=5)
    n2.train(x)
    n2.stop_training()

    y2 = n2.execute(x)
    deltas_pca = comp_delta(y2)
    assert_array_almost_equal(deltas_igsfa, deltas_pca, decimal)
Esempio n. 2
0
def test_equivalence_GSFA_PCA_for_DT_0():
    """ Test of iGSFA and PCA when delta_threshold is smaller than 0.0
    """
    x = numx.random.normal(size=(300, 15))

    n = iGSFANode(output_dim=5,
                  slow_feature_scaling_method=None,
                  delta_threshold=0.0)
    n.train(x, train_mode="regular")
    # n.stop_training() has been automatically called

    y = n.execute(x)
    deltas_igsfa = comp_delta(y)

    n2 = mdp.nodes.PCANode(output_dim=5)
    n2.train(x)
    n2.stop_training()

    y2 = n2.execute(x)
    deltas_pca = comp_delta(y2)
    assert_array_almost_equal(deltas_igsfa, deltas_pca, decimal)
Esempio n. 3
0
def test_equivalence_smirror_window32_mirror_window32():
    """Tests the equivalence of slow and fast mirroring sliding windows
    for GSFA.
    """
    x = numx.random.normal(size=(200, 15))
    training_modes = ("smirror_window32", "mirror_window32")

    delta_values = []
    for training_mode in training_modes:
        n = mdp.nodes.GSFANode(output_dim=5)
        n.train(x, train_mode=training_mode)
        n.stop_training()

        y = n.execute(x)
        delta = comp_delta(y)
        delta_values.append(delta)

    assert_array_almost_equal(delta_values[1], delta_values[0], decimal)
Esempio n. 4
0
def test_equivalence_smirror_window32_mirror_window32():
    """Tests the equivalence of slow and fast mirroring sliding windows
    for GSFA.
    """
    x = numx.random.normal(size=(200, 15))
    training_modes = ("smirror_window32", "mirror_window32")

    delta_values = []
    for training_mode in training_modes:
        n = mdp.nodes.GSFANode(output_dim=5)
        n.train(x, train_mode=training_mode)
        n.stop_training()

        y = n.execute(x)
        delta = comp_delta(y)
        delta_values.append(delta)

    assert_array_almost_equal(delta_values[1], delta_values[0], decimal)