The team needs a reliable implementation for embedding preprocessing in a production-oriented ML workflow. A small implementation error can change the model input or metric enough to make a downstream result misleading.
Normalize each numeric feature vector to unit L2 norm before it enters a similarity model.
Scale the vector so its Euclidean (L2) length is exactly 1 while its direction stays the same. The all-zero vector has no direction, so it is returned unchanged.
Implement solve(x).
Returns. Return a float NumPy vector of the same shape.
Example 1
Input:
solve([3.0, 4.0])
Output:
[0.6, 0.8]
Example 2
Input:
solve([0.0, 0.0])
Output:
[0.0, 0.0]
No results yet
Run your code to check it against the examples, or submit to run every test.