#NEWLINE# def test_mcmc_warm_start( ) : #NEWLINE# #INDENT# ( X , y , coef ) = make_user_item_regression ( label_stdev = 0 ) #NEWLINE# from sklearn.cross_validation import train_test_split #NEWLINE# ( X_train , X_test , y_train , y_test ) = train_test_split ( X , y , test_size = 0.33 , random_state = 44 ) #NEWLINE# X_train = sp . csc_matrix ( X_train ) #NEWLINE# X_test = sp . csc_matrix ( X_test ) #NEWLINE# fm = mcmc . FMRegression ( n_iter = 100 , rank = 2 ) #NEWLINE# y_pred = fm . fit_predict ( X_train , y_train , X_test ) #NEWLINE# error_10_iter = mean_squared_error ( y_pred , y_test ) #NEWLINE# fm = mcmc . FMRegression ( n_iter = 50 , rank = 2 ) #NEWLINE# y_pred = fm . fit_predict ( X_train , y_train , X_test ) #NEWLINE# error_5_iter = mean_squared_error ( y_pred , y_test ) #NEWLINE# y_pred = fm . fit_predict ( X_train , y_train , X_test , n_more_iter = 50 ) #NEWLINE# error_5_iter_plus_5 = mean_squared_error ( y_pred , y_test ) #NEWLINE# print ( error_5_iter , error_10_iter , error_10_iter ) #NEWLINE# print ( fm . hyper_param_ ) #NEWLINE# assert_almost_equal ( error_10_iter , error_5_iter_plus_5 , decimal = 2 )