e83c4ba2424b141f626e8fc911286b7996649c62,src/spn/experiments/RandomSPNs/train_mnist.py,,,#,65

Before Change



    sess = tf.Session()
    sess.run(tf.global_variables_initializer())
    dummy_input = np.random.normal(0.0, 1.2, [10, 9])
    input_ph = tf.placeholder(tf.float32, [10, 9])
    output_tensor = spn.forward(input_ph)
    tf_output = sess.run(output_tensor, feed_dict={input_ph: dummy_input})

After Change


    train_spn(spn, train_im, train_labels, num_epochs=3, sess=sess)

    // dummy_input = np.random.normal(0.0, 1.2, [10, 9])
    dummy_input = train_im[:5]
    input_ph = tf.placeholder(tf.float32, dummy_input.shape)
    output_tensor = spn.forward(input_ph)
    tf_output = sess.run(output_tensor, feed_dict={input_ph: dummy_input})

    output_nodes = spn.get_simple_spn(sess)
    simple_output = []
    for node in output_nodes:
        simple_output.append(inference.log_likelihood(node, dummy_input)[:, 0])
    // graphics.plot_spn2(output_nodes[0])
    // graphics.plot_spn_to_svg(output_nodes[0])
    simple_output = np.stack(simple_output, axis=-1)
    print(tf_output, simple_output)
    simple_output = softmax(simple_output, axis=1)
    tf_output = softmax(tf_output, axis=1) + 1e-100
    print(tf_output, simple_output)
    relative_error = np.abs(simple_output / tf_output - 1)
    print(np.average(relative_error))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: SPFlow/SPFlow
Commit Name: e83c4ba2424b141f626e8fc911286b7996649c62
Time: 2018-07-16
Author: stelzner@cs.tu-darmstadt.de
File Name: src/spn/experiments/RandomSPNs/train_mnist.py
Class Name:
Method Name:


Project Name: datascienceinc/Skater
Commit Name: a0a2a65ddbcd5e5f27ca02bf0607f718e415d370
Time: 2017-03-20
Author: aikramer2@gmail.com
File Name: pyinterpret/tests/test_data.py
Class Name: TestData
Method Name: test_1D_numpy_array


Project Name: SPFlow/SPFlow
Commit Name: 6bc6978ad31c2adda4540f059340dc61ce4fde3c
Time: 2018-09-11
Author: stelzner@cs.tu-darmstadt.de
File Name: src/spn/experiments/RandomSPNs/train_mnist.py
Class Name:
Method Name: