Similarity Measures
Q1. A data scientist extracts a feature vector from an image using a pre-trained ResNet34 CNN as follows
import torchvision.models as models
...
res_model = models.resnet34(pretrained=True)
```
He then applies the following algorithm, entitled xxx on the image.
```python
import math
def xxx(arr):
mod = 0.0
for i in arr:
mod += i * i
mag = math.sqrt(mod)
for i in range(len(arr)):
arr[i] /= mag
# Example usage:
arr = [1.0, 2.0, 3.0]
xxx(arr)
print(arr)
```
Which results in this list:
<table align='center'>
<tr>
<td align="center">
<img src="img/similarity-1.png" style="max-width:70%;" />
</td>
</tr>
</table>
Name the algorithm that he used and explain in detail why he used it.