Square Machine Learning Engineer | October 2020
Position: Machine Learning Engineer
How was the interview process? What was it like?
What technical questions were asked?
What was one of your solutions?
Compute cosine similarity of each of the list in the matrix with input list which also represents target user's row in the matrix. Add Cosine scores with corresponding row indices to HashMap and sort in descending order of cosine scores. This would represent top users as row_index = user
Now iterate through top k keys(or row indices) in hash map and capture their column indices(only where value is 1 and should not clash with input user column indices) from matrix. Add it to new hash map of row(represents user) and column index(represents product type).
As a final step, Replace Column Index with product types by referencing product_code dictionary given in the question
Machine Learning Engineer