mirror of
https://github.com/3b1b/manim.git
synced 2025-07-29 21:12:35 +08:00
Random fixes to old_projects
This commit is contained in:
@ -2351,6 +2351,7 @@ class TransitionFromPathsToBoundariesArrowless(TransitionFromPathsToBoundaries):
|
||||
|
||||
class BreakDownLoopWithNonzeroWinding(TransitionFromPathsToBoundaries):
|
||||
def construct(self):
|
||||
TransitionFromPathsToBoundaries.construct(self)
|
||||
zero_point = 2*LEFT
|
||||
|
||||
squares, joint_rect = self.get_squares_and_joint_rect()
|
||||
|
@ -337,7 +337,7 @@ class LeviSolution(CycloidScene):
|
||||
new_theta.next_to(new_arc, LEFT)
|
||||
new_theta.shift(0.1*DOWN)
|
||||
kwargs = {
|
||||
"stroke_width" : 2*DEFAULT_POINT_THICKNESS,
|
||||
"stroke_width" : 2*DEFAULT_STROKE_WIDTH,
|
||||
}
|
||||
triangle1 = Polygon(
|
||||
self.p_point, self.c_point, self.bottom_point,
|
||||
|
@ -9,7 +9,7 @@ from big_ol_pile_of_manim_imports import *
|
||||
from functools import reduce
|
||||
|
||||
DEFAULT_PLANE_CONFIG = {
|
||||
"stroke_width" : 2*DEFAULT_POINT_THICKNESS
|
||||
"stroke_width" : 2*DEFAULT_STROKE_WIDTH
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ import sys
|
||||
|
||||
from big_ol_pile_of_manim_imports import *
|
||||
|
||||
ARROW_CONFIG = {"stroke_width" : 2*DEFAULT_POINT_THICKNESS}
|
||||
ARROW_CONFIG = {"stroke_width" : 2*DEFAULT_STROKE_WIDTH}
|
||||
LIGHT_RED = RED_E
|
||||
|
||||
def matrix_to_string(matrix):
|
||||
@ -52,7 +52,7 @@ class ShowMultiplication(NumberLineScene):
|
||||
def construct(self, num, show_original_line):
|
||||
config = {
|
||||
"density" : max(abs(num), 1)*DEFAULT_POINT_DENSITY_1D,
|
||||
"stroke_width" : 2*DEFAULT_POINT_THICKNESS
|
||||
"stroke_width" : 2*DEFAULT_STROKE_WIDTH
|
||||
}
|
||||
if abs(num) < 1:
|
||||
config["numerical_radius"] = FRAME_X_RADIUS/num
|
||||
@ -115,7 +115,7 @@ class ExamplesOfNonlinearOneDimensionalTransforms(NumberLineScene):
|
||||
self.clear()
|
||||
self.add(self.nonlinear)
|
||||
config = {
|
||||
"stroke_width" : 2*DEFAULT_POINT_THICKNESS,
|
||||
"stroke_width" : 2*DEFAULT_STROKE_WIDTH,
|
||||
"density" : 5*DEFAULT_POINT_DENSITY_1D,
|
||||
}
|
||||
NumberLineScene.construct(self, **config)
|
||||
@ -144,7 +144,7 @@ class ShowTwoThenThree(ShowMultiplication):
|
||||
|
||||
def construct(self):
|
||||
config = {
|
||||
"stroke_width" : 2*DEFAULT_POINT_THICKNESS,
|
||||
"stroke_width" : 2*DEFAULT_STROKE_WIDTH,
|
||||
"density" : 6*DEFAULT_POINT_DENSITY_1D,
|
||||
}
|
||||
NumberLineScene.construct(self, **config)
|
||||
@ -163,7 +163,7 @@ class TransformScene2D(Scene):
|
||||
"x_radius" : FRAME_WIDTH,
|
||||
"y_radius" : FRAME_WIDTH,
|
||||
"density" : DEFAULT_POINT_DENSITY_1D*density_factor,
|
||||
"stroke_width" : 2*DEFAULT_POINT_THICKNESS
|
||||
"stroke_width" : 2*DEFAULT_STROKE_WIDTH
|
||||
}
|
||||
if not use_faded_lines:
|
||||
config["x_faded_line_frequency"] = None
|
||||
@ -323,7 +323,7 @@ class ExamplesOfNonlinearTwoDimensionalTransformations(Scene):
|
||||
"x_radius" : FRAME_WIDTH,
|
||||
"y_radius" : FRAME_WIDTH,
|
||||
"density" : 3*DEFAULT_POINT_DENSITY_1D,
|
||||
"stroke_width" : 2*DEFAULT_POINT_THICKNESS
|
||||
"stroke_width" : 2*DEFAULT_STROKE_WIDTH
|
||||
}
|
||||
number_plane = NumberPlane(**config)
|
||||
numbers = number_plane.get_coordinate_labels()
|
||||
@ -377,7 +377,7 @@ class TrickyExamplesOfNonlinearTwoDimensionalTransformations(Scene):
|
||||
"x_radius" : 0.6*FRAME_WIDTH,
|
||||
"y_radius" : 0.6*FRAME_WIDTH,
|
||||
"density" : 10*DEFAULT_POINT_DENSITY_1D,
|
||||
"stroke_width" : 2*DEFAULT_POINT_THICKNESS
|
||||
"stroke_width" : 2*DEFAULT_STROKE_WIDTH
|
||||
}
|
||||
number_plane = NumberPlane(**config)
|
||||
phrase1, phrase2 = TextMobject([
|
||||
|
Binary file not shown.
@ -40,7 +40,11 @@ def load_data():
|
||||
below.
|
||||
"""
|
||||
f = gzip.open('/Users/grant/cs/neural-networks-and-deep-learning/data/mnist.pkl.gz', 'rb')
|
||||
training_data, validation_data, test_data = pickle.load(f)
|
||||
u = pickle._Unpickler(f)
|
||||
u.encoding = 'latin1'
|
||||
# p = u.load()
|
||||
# training_data, validation_data, test_data = pickle.load(f)
|
||||
training_data, validation_data, test_data = u.load()
|
||||
f.close()
|
||||
return (training_data, validation_data, test_data)
|
||||
|
||||
|
@ -165,8 +165,8 @@ class Network(object):
|
||||
return sum(int(x == y) for (x, y) in test_results)
|
||||
|
||||
def cost_derivative(self, output_activations, y):
|
||||
"""Return the vector of partial derivatives \partial C_x /
|
||||
\partial a for the output activations."""
|
||||
"""Return the vector of partial derivatives \\partial C_x /
|
||||
\\partial a for the output activations."""
|
||||
return (output_activations-y)
|
||||
|
||||
#### Miscellaneous functions
|
||||
@ -195,8 +195,8 @@ def ReLU_prime(z):
|
||||
return (np.array(z) > 0).astype('int')
|
||||
|
||||
def get_pretrained_network():
|
||||
data_file = open(PRETRAINED_DATA_FILE)
|
||||
weights, biases = pickle.load(data_file)
|
||||
data_file = open(PRETRAINED_DATA_FILE, 'rb')
|
||||
weights, biases = pickle.load(data_file, encoding='latin1')
|
||||
sizes = [w.shape[1] for w in weights]
|
||||
sizes.append(weights[-1].shape[0])
|
||||
network = Network(sizes)
|
||||
@ -275,13 +275,13 @@ def save_organized_images(n_images_per_number = 10):
|
||||
if len(image_map[value]) >= n_images_per_number:
|
||||
continue
|
||||
image_map[value].append(im)
|
||||
data_file = open(IMAGE_MAP_DATA_FILE, mode = 'w')
|
||||
data_file = open(IMAGE_MAP_DATA_FILE, mode = 'wb')
|
||||
pickle.dump(image_map, data_file)
|
||||
data_file.close()
|
||||
|
||||
def get_organized_images():
|
||||
data_file = open(IMAGE_MAP_DATA_FILE, mode = 'r')
|
||||
image_map = pickle.load(data_file)
|
||||
image_map = pickle.load(data_file, encoding='latin1')
|
||||
data_file.close()
|
||||
return image_map
|
||||
|
||||
|
@ -144,10 +144,10 @@ class NetworkMobject(VGroup):
|
||||
if size > n_neurons:
|
||||
dots = TexMobject("\\vdots")
|
||||
dots.move_to(neurons)
|
||||
VGroup(*neurons[:len(neurons)/2]).next_to(
|
||||
VGroup(*neurons[:len(neurons) // 2]).next_to(
|
||||
dots, UP, MED_SMALL_BUFF
|
||||
)
|
||||
VGroup(*neurons[len(neurons)/2:]).next_to(
|
||||
VGroup(*neurons[len(neurons) // 2:]).next_to(
|
||||
dots, DOWN, MED_SMALL_BUFF
|
||||
)
|
||||
layer.dots = dots
|
||||
|
@ -453,7 +453,7 @@ class DefineInscribedSquareProblem(ClosedLoopScene):
|
||||
pi_loop.set_fill(opacity = 0)
|
||||
pi_loop.set_stroke(
|
||||
color = WHITE,
|
||||
width = DEFAULT_POINT_THICKNESS
|
||||
width = DEFAULT_STROKE_WIDTH
|
||||
)
|
||||
pi_loop.set_height(4)
|
||||
randy = Randolph()
|
||||
|
Reference in New Issue
Block a user