Example #1
0
def test_tf_autoencoder(pandas):
    """Just makes sure that this code will run; it doesn't check that
    it is creating good models.
    """
    X = utils.randmatrix(20, 50)
    if pandas:
        X = pd.DataFrame(X)
    ae = tf_autoencoder.TfAutoencoder(hidden_dim=5, max_iter=100)
    H = ae.fit(X)
    ae.predict(X)
    H_is_pandas = isinstance(H, pd.DataFrame)
    assert H_is_pandas == pandas
Example #2
0
                }
        ],
        [
            tf_shallow_neural_classifier.TfShallowNeuralClassifier(
                hidden_dim=5,
                hidden_activation=tf.nn.tanh,
                max_iter=1,
                eta=1.0), {
                    'hidden_dim': 10,
                    'hidden_activation': tf.nn.relu,
                    'max_iter': 10,
                    'eta': 0.1
                }
        ],
        [
            tf_autoencoder.TfAutoencoder(hidden_dim=5,
                                         hidden_activation=tf.nn.tanh,
                                         max_iter=1,
                                         eta=1.0), {
                                             'hidden_dim': 10,
                                             'hidden_activation': tf.nn.relu,
                                             'max_iter': 10,
                                             'eta': 0.1
                                         }
        ]
    ])
def test_parameter_setting(model, params):
    model.set_params(**params)
    for p, val in params.items():
        assert getattr(model, p) == val