202908a6634e9ac5b15658ed3f0cfe50606f32f2,examples/opensets/mnist_model2.py,,,#,41

Before Change


    print("Predictions")
    predictions = np.concatenate(test_pp.get_variable("all_predictions"))
    targets = np.concatenate(test_pp.get_variable("all_targets"))
    accuracy = (predictions == targets).sum() / len(predictions) * 100
    print("Accuracy {:6.2f}".format(accuracy))
    print(targets)
    print(predictions)

After Change


                                                   //labels={"shape": 10, "dtype": "uint8",
                                                   labels={"classes": (10+np.arange(10)).astype("str"),
                                                           "transform": "ohe", "name": "targets"}),
                                    "output": dict(ops=["labels", "accuracy"])})
                .make_digits()
                .train_model("conv", fetches="loss",
                                     feed_dict={V("input_tensor_name"): B("images"),
                                                "labels": B("digits")},
                             save_to=V("current_loss"))
                .print_variable("current_loss")
                .update_variable("loss_history", V("current_loss"), mode="a"))

    train_pp = (train_tp << mnist.train)
    train_pp.run(BATCH_SIZE, shuffle=True, n_epochs=1, drop_last=True, prefetch=0)
    print("End training", time() - t)


    print()
    print("Start testing...")
    t = time()
    test_pp = (mnist.test.p
                .import_model("conv", train_pp)
                .init_variable("accuracy", init_on_each_run=list)
                .make_digits()
                .predict_model("conv", fetches="accuracy", feed_dict={"images": B("images"),
                                                                      "labels": B("digits")},
                               save_to=V("accuracy"), mode="a")
                .run(BATCH_SIZE, shuffle=True, n_epochs=1, drop_last=False, prefetch=0))
    print("End testing", time() - t)

    accuracy = test_pp.get_variable("accuracy")
    print("Accuracy {:6.2f}".format(np.array(accuracy).mean()))

    conv = train_pp.get_model_by_name("conv")
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: analysiscenter/batchflow
Commit Name: 202908a6634e9ac5b15658ed3f0cfe50606f32f2
Time: 2017-11-14
Author: rhudor@gmail.com
File Name: examples/opensets/mnist_model2.py
Class Name:
Method Name:


Project Name: bokeh/bokeh
Commit Name: 1c0433bcd6928e55ee70e582fd538c3bc854d04e
Time: 2017-01-09
Author: bryanv@continuum.io
File Name: examples/embed/widget.py
Class Name:
Method Name: update_pyramid


Project Name: bokeh/bokeh
Commit Name: 1c0433bcd6928e55ee70e582fd538c3bc854d04e
Time: 2017-01-09
Author: bryanv@continuum.io
File Name: examples/models/population_server.py
Class Name:
Method Name: update_pyramid