Пример #1
0
 def show_all_activation_images(self, network, test_data):
     image_samples = Group(*[
         self.get_activation_images(digit, network, test_data)
         for digit in range(10)
     ])
     image_samples.arrange_submobjects_in_grid(n_rows=2, buff=LARGE_BUFF)
     image_samples.scale_to_fit_height(FRAME_HEIGHT - 1)
     self.add(image_samples)
Пример #2
0
 def show_maximizing_inputs(self, network):
     training_data, validation_data, test_data = load_data_wrapper()
     layer = 1
     n_neurons = DEFAULT_LAYER_SIZES[layer]
     groups = Group()
     for k in range(n_neurons):
         out = np.zeros(n_neurons)
         out[k] = 1
         in_vect = maximizing_input(network, layer, out)
         new_out = network.get_activation_of_all_layers(in_vect)[layer]
         group = Group(*map(MNistMobject, [in_vect, new_out]))
         group.arrange_submobjects(DOWN + RIGHT, SMALL_BUFF)
         groups.add(group)
     groups.arrange_submobjects_in_grid()
     groups.scale_to_fit_height(FRAME_HEIGHT - 1)
     self.add(groups)