Myntra-inspired recommendation experiment is preparing a feature for train and validation data while avoiding information leakage. You need to fit the standardization statistics on the training portion only and apply those same statistics to the validation portion.
Standardise the training matrix and the validation matrix using only the training statistics: the column means and population standard deviations of train (a zero standard deviation is replaced by 1). Apply the same means and scales to both matrices.
Implement solve(train, val).
Returns. Return a tuple (train_scaled, val_scaled) of float NumPy matrices.
Example 1
Input:
solve([[1, 2], [3, 4]], [[100, 6]])
Output:
([[-1.0, -1.0], [1.0, 1.0]], [[98.0, 3.0]])
Example 2
Input:
solve([[5.0, 1.0], [5.0, 3.0]], [[7.0, 2.0]])
Output:
([[0.0, -1.0], [0.0, 1.0]], [[2.0, 0.0]])
No results yet
Run your code to check it against the examples, or submit to run every test.