Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_matrix_factorization_with_low_rank_random_matrix():
solver = MatrixFactorization(
learning_rate=0.01,
rank=3,
l2_penalty=0,
min_improvement=1e-6)
XY_completed = solver.fit_transform(XY_incomplete)
_, missing_mae = reconstruction_error(
XY,
XY_completed,
missing_mask,
name="MatrixFactorization")
assert missing_mae < 0.1, "Error too high!"
def impute_mf(X, mask, hyperparams={'rank':[5,10,50],'l2_penalty':[1e-3, 1e-5]}):
return fancyimpute_hpo(MatrixFactorization, hyperparams, X, mask)