#NEWLINE# def test_fm_sgd_regression( ) : #NEWLINE# #INDENT# ( w0 , w , V , y , X ) = get_test_problem ( ) #NEWLINE# X_test = X . copy ( ) #NEWLINE# X_train = sp . csc_matrix ( X ) #NEWLINE# fm = sgd . FMRegression ( n_iter = 10000 , init_stdev = 0.01 , l2_reg_w = 0.5 , l2_reg_V = 50.5 , rank = 2 , step_size = 0.0001 ) #NEWLINE# fm . fit ( X_train , y ) #NEWLINE# y_pred = fm . predict ( X_test ) #NEWLINE# assert ( metrics . r2_score ( y_pred , y ) > 0.99 )