Just practice vectorization. Like take this as an example: Set all 0 values to 1.
You could do it with a for loop like
for i in range(len(arr)):
if arr[i] == 0:
arr[i] = 1
But using vectorization you can easily do
arr[arr==0] = 1
This is probably why you're having issues with completing it on time just because the first way requires way more coding. On top of that it's more efficient in terms of time complexity. This is especially useful in CV since you're dealing with images which are like a 600×600×3 array. Without vectorization making adjustments to a data set of like 10,000 images would take forever.
lehmanmafia t1_iswx0bd wrote
Reply to [D] How frustrating are the ML interviews these days!!! TOP 3% interview joke by Mogady
Just practice vectorization. Like take this as an example: Set all 0 values to 1. You could do it with a for loop like
for i in range(len(arr)):
But using vectorization you can easily do
arr[arr==0] = 1
This is probably why you're having issues with completing it on time just because the first way requires way more coding. On top of that it's more efficient in terms of time complexity. This is especially useful in CV since you're dealing with images which are like a 600×600×3 array. Without vectorization making adjustments to a data set of like 10,000 images would take forever.