Example #1
0
def test_theano_naive_factorization():
    spn = SpnFactory.theano_naive_factorization(vars)
    print('Naive factorization (indicators)')
    print(spn)

    spn = SpnFactory.theano_naive_factorization(vars, naive_freqs)
    print('Naive factorization (smoothing)')
    print(spn)
Example #2
0
def test_theano_naive_factorization():
    spn = SpnFactory.theano_naive_factorization(vars)
    print('Naive factorization (indicators)')
    print(spn)

    spn = SpnFactory.theano_naive_factorization(vars,
                                                naive_freqs)
    print('Naive factorization (smoothing)')
    print(spn)
Example #3
0
def atest_theano_nltcs_naive_spn():
    # load the dataset
    print('Loading datasets')
    train, valid, test = dataset.load_train_val_test_csvs('tmovie')
    n_test_instances = test.shape[0]
    # estimating the frequencies for the features
    print('Estimating features')
    freqs, features = dataset.data_2_freqs(train)

    print('Building naive factorization')
    spn = SpnFactory.theano_naive_factorization(features,
                                                freqs,
                                                alpha=0,
                                                batch_size=n_test_instances)
    print('Evaluating on test')
    ll = spn.eval(test.T)
    avg_ll = ll.mean()
    print(avg_ll)
Example #4
0
def atest_theano_nltcs_naive_spn():
    # load the dataset
    print('Loading datasets')
    train, valid, test = dataset.load_train_val_test_csvs('tmovie')
    n_test_instances = test.shape[0]
    # estimating the frequencies for the features
    print('Estimating features')
    freqs, features = dataset.data_2_freqs(train)

    print('Building naive factorization')
    spn = SpnFactory.theano_naive_factorization(features,
                                                freqs,
                                                alpha=0,
                                                batch_size=n_test_instances)
    print('Evaluating on test')
    ll = spn.eval(test.T)
    avg_ll = ll.mean()
    print(avg_ll)