@@ -157,7 +157,7 @@ def q(tl, s):
157
157
q (tl + s * unit_y , s ) | q (tl + s * (unit_y + unit_x ), s )
158
158
)
159
159
160
- return q (P2 (0 , 0 ), 1 )
160
+ return q (P2 (0 , 0 ), 1 ) # noqa: F821
161
161
162
162
163
163
def draw_graph (f , c1 = Color ("red" ), c2 = Color ("lightblue" )):
@@ -167,22 +167,22 @@ def draw_graph(f, c1=Color("red"), c2=Color("lightblue")):
167
167
def compare (m1 , m2 ):
168
168
return (
169
169
draw_graph (m1 ).center_xy ()
170
- | hstrut (0.5 )
171
- | text ("→" , 0.5 ).fill_color (Color ("black" ))
172
- | hstrut (0.5 )
170
+ | hstrut (0.5 ) # noqa: F821
171
+ | text ("→" , 0.5 ).fill_color (Color ("black" )) # noqa: F821
172
+ | hstrut (0.5 ) # noqa: F821
173
173
| draw_graph (m2 ).center_xy ()
174
174
)
175
175
176
176
177
177
def with_points (pts1 , pts2 , b ):
178
178
"Draw a picture showing line to boundary"
179
179
w1 , w2 = 1 , 1
180
- model = Linear (w1 , w2 , b )
180
+ model = Linear (w1 , w2 , b ) # noqa: F821
181
181
line = make_path ([(0 , b ), (1 , b + 1 )])
182
182
dia = draw_graph (model ) + split_graph (pts1 , pts2 , False )
183
183
184
184
for pt in pts1 :
185
- pt2 = line .get_trace ().trace_p (P2 (pt [0 ], - pt [1 ]), V2 (- 1 , 1 ))
185
+ pt2 = line .get_trace ().trace_p (P2 (pt [0 ], - pt [1 ]), V2 (- 1 , 1 )) # noqa: F821
186
186
if pt2 :
187
187
dia += make_path ([(pt [0 ], - pt [1 ]), pt2 ]).dashing ([5 , 5 ], 0 )
188
188
return dia
@@ -216,22 +216,26 @@ def show_loss(full_loss):
216
216
i = 0
217
217
for j , b in enumerate (range (20 )):
218
218
b = - 1.7 + b / 20
219
- m = Linear (1 , 1 , b )
219
+ m = Linear (1 , 1 , b ) # noqa: F821
220
220
pt = (b , full_loss (m ))
221
221
path .append (pt )
222
222
if j % 5 == 0 :
223
- d = d | hstrut (0.5 ) | show (m ).named (("graph" , i ))
224
- p = circle (0.01 ).translate (pt [0 ], pt [1 ]).fill_color (Color ("black" ))
223
+ d = d | hstrut (0.5 ) | show (m ).named (("graph" , i )) # noqa: F821
224
+ p = (
225
+ circle (0.01 ) # noqa: F821
226
+ .translate (pt [0 ], pt [1 ])
227
+ .fill_color (Color ("black" ))
228
+ )
225
229
p = p .named (("x" , i ))
226
230
i += 1
227
231
scores .append (p )
228
232
d = (
229
- (concat (scores ) + make_path (path )).center_xy ().scale (3 )
230
- / vstrut (0.5 )
233
+ (concat (scores ) + make_path (path )).center_xy ().scale (3 ) # noqa: F821
234
+ / vstrut (0.5 ) # noqa: F821
231
235
/ d .scale (2 ).center_xy ()
232
236
)
233
237
for i in range (i ):
234
- d = d .connect (("graph" , i ), ("x" , i ), ArrowOpts (head_pad = 0.1 ))
238
+ d = d .connect (("graph" , i ), ("x" , i ), ArrowOpts (head_pad = 0.1 )) # noqa: F821
235
239
return d
236
240
237
241
0 commit comments