Seems to only ever guess a label it was trained on, so its accuracy is just whatever percent of the test data is labelled one of the things it trained on. This is with approximately even distribution of labels, and so far only with simple_regression.
In [115]:
def expected_accuracy_if_only_guesses_trained_labels(min_train, max_train, min_test, max_test):
different_answers = max_test - min_test + 1
answers_given = max_train - min_train + 1
# note if there are more labels trained on than will be tested on, this model says 100% accuracy,
# where via the simple math it would be over 100%
# This appears to be true, ie teaching someone about heptagons doesn't hurt their ability to label triangles
return min(1.0, answers_given / different_answers)
print("Expected accuracy if it only guesses a label it has been trained on:")
for min_train in [3]:
for max_train in [3, 4, 5, 9]:
print()
for min_test in [3]:
for max_test in [3, 4, 5, 6, 9]:
acccuracy = expected_accuracy_if_only_guesses_trained_labels(min_train, max_train, min_test, max_test)
print("train:[%s, %s] test:[%s, %s] => %s" % (min_train, max_train, min_test, max_test, acccuracy))
All these results based on 10,000 training, 1,000 test images, with 1000 training steps in batches of 100
In [66]:
from polygoggles.make_polygon_pngs import make_collection
from polygoggles.simple_softmax import run_simple_softmax_on_collection
In [99]:
IMAGE_WIDTH = 28
IMAGE_HEIGHT = 28
NUM_TRAINING_IMAGES = 10000
NUM_TEST_IMAGES = 1000
In [116]:
MIN_TEST_EDGES = 3
MAX_TEST_EDGES = 9
TRAINING_EDGE_MIN_MAX = [5, 5]
# We need to first make
collection_dir = make_collection(IMAGE_WIDTH, IMAGE_HEIGHT, NUM_TRAINING_IMAGES, NUM_TEST_IMAGES,
allow_rotation=True, min_edges=MIN_TEST_EDGES, max_edges=MAX_TEST_EDGES,
training_num_edges_limited_to_range=TRAINING_EDGE_MIN_MAX)
In [118]:
accuracy = run_simple_softmax_on_collection(collection_dir,
num_training_steps=1000,
training_batch_size=100)
expected_accuracy = expected_accuracy_if_only_guesses_trained_labels(TRAINING_EDGE_MIN_MAX[0],
TRAINING_EDGE_MIN_MAX[1],
MIN_TEST_EDGES,
MAX_TEST_EDGES)
print("%.3f accuracy seen" % accuracy)
print("%.3f accuracy projected by model" % expected_accuracy)
In [ ]: