def test_waldo():
    """
    This method will run the test on waldo dataset. 
    """
    #dg = waldo(dimensions = (256,256)) # Initialize a dataset creator
    dg = waldo()  # Initialize a dataset creator
    training_data, training_labels = dg.query_data(samples=1000)

    testing_data, testing_labels = dg.query_data(samples=1000)
    #dg._demo()
    num = [5, 6, 7, 8, 9, 10, 20, 40, 50, 70, 100, 120, 140]

    for i in range(len(num)):
        print 'Hidden layers: ', num[i]
        t0 = time.time()
        n = mlnn(
            training_data, training_labels,
            num[i])  # This call should return a net object that is trained.
        params = n.get_params(
        )  # This call should reaturn parameters of the model that are
        # fully trained.
        predictions = n.get_predictions(
            testing_data)  # This call should return predictions.

        acc = accuracy(testing_labels, predictions)
        print "Accuracy of predictions on waldo data = " + str(acc) + "%"
        t1 = time.time()
        print "Time taken: ", t1 - t0

    return acc
Пример #2
0
def test_waldo():
    """
    This method will run the test on waldo dataset. 
    """
    dg = waldo()  # Initialize a dataset creator
    training_data, training_labels = dg.query_data(samples=100)

    n = mlnn(training_data, training_labels
             )  # This call should return a net object that is trained.
    params = n.get_params(
    )  # This call should reaturn parameters of the model that are
    # fully trained.

    testing_data, testing_labels = dg.query_data(samples=100)
    predictions = n.get_predictions(
        testing_data)  # This call should return predictions.

    print "Accuracy of predictions on waldo data = " + str(
        accuracy(testing_labels, predictions)) + "%"