You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am sure by now you can check the run time without my help.
177
178
178
179
Would it be feasable to process all 4170 rows with this fastest function?
179
180
181
+
---
180
182
181
183
## The key lesson
182
184
@@ -204,8 +206,10 @@ Why? Because even a for loop calls Python code repeatedly whereas the vectorized
204
206
205
207
# Exercise
206
208
207
-
Take the function ``zscore_rows`` and convert it from using a numpy ndarray to using our own data structure.
208
-
While doing that change tha action to modifying the data in place.
209
+
Take the function ``vectorized_dist`` and convert it from using a numpy ndarray to using our own data structure.
210
+
While doing that we should think about storing this data in our object.
211
+
Currently this neighbor graph is nothing that we need repetetly, but it is rather costly to create.
212
+
Instead of only returning the neighbor graph, store it in the dict, too.
209
213
210
214
**Note:** Mutable objects (like lists, dictionaries, and arrays) can be changed inside a function, while immutable objects (like numbers and strings) cannot. Think of it like "Small objects like numbers or strings can be copied, but putatively large ones like matrices or dictionaries should not be copied".
0 commit comments