Beispiel #1
0
def test_tf_rnn_classifier_cheese_disease(cheese_disease_dataset):
    mod = tf_rnn_classifier.TfRNNClassifier(
        vocab=cheese_disease_dataset['vocab'],
        embed_dim=20,
        hidden_dim=20,
        max_iter=20)
    mod.fit(cheese_disease_dataset['X_train'],
            cheese_disease_dataset['y_train'])
    pred = mod.predict(cheese_disease_dataset['X_test'])
    assert accuracy_score(cheese_disease_dataset['y_test'], pred) > 0.80
Beispiel #2
0
def test_tf_rnn_classifier(X_sequence):
    """Just makes sure that this code will run; it doesn't check that
    it is creating good models.
    """
    train, test, vocab = X_sequence
    mod = tf_rnn_classifier.TfRNNClassifier(vocab=vocab, max_iter=100)
    X, y = zip(*train)
    X_test, _ = zip(*test)
    mod.fit(X, y)
    mod.predict(X_test)
    mod.predict_proba(X_test)
Beispiel #3
0
         vocab=[], max_iter=10, hidden_dim=5, eta=0.1), {
             'hidden_dim': 10,
             'eta': 1.0,
             'max_iter': 100
         }
 ],
 [
     torch_rnn_classifier.TorchRNNClassifier(
         vocab=[], max_iter=10, hidden_dim=5, eta=0.1), {
             'hidden_dim': 10,
             'eta': 1.0,
             'max_iter': 100
         }
 ],
 [
     tf_rnn_classifier.TfRNNClassifier(
         vocab=[], max_iter=10, hidden_dim=5, eta=0.1), {
             'hidden_dim': 10,
             'eta': 1.0,
             'max_iter': 100
         }
 ],
 [
     np_tree_nn.TreeNN(vocab=[], max_iter=10, hidden_dim=5, eta=0.1), {
         'embed_dim': 5,
         'hidden_dim': 10,
         'eta': 1.0,
         'max_iter': 100
     }
 ],
 [
     torch_tree_nn.TorchTreeNN(