예제 #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(2 * SPACE_HEIGHT - 1)
     self.add(image_samples)
예제 #2
0
파일: playground.py 프로젝트: nobabe/manim
 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(2*SPACE_HEIGHT - 1)
     self.add(groups)