def sparse_GP_regression_2D(num_samples=<NUM_LIT>, num_inducing=<NUM_LIT:50>, max_iters=<NUM_LIT:100>, optimize=True, plot=True, nan=False):
np.random.seed(<NUM_LIT>)<EOL>X = np.random.uniform(-<NUM_LIT>, <NUM_LIT>, (num_samples, <NUM_LIT:2>))<EOL>Y = np.sin(X[:, <NUM_LIT:0>:<NUM_LIT:1>]) * np.sin(X[:, <NUM_LIT:1>:<NUM_LIT:2>]) + np.random.randn(num_samples, <NUM_LIT:1>) * <NUM_LIT><EOL>if nan:<EOL><INDENT>inan = np.random.binomial(<NUM_LIT:1>,<NUM_LIT>,size=Y.shape)<EOL>Y[inan] = np.nan<EOL><DEDENT>rbf = GPy.kern.RBF(<NUM_LIT:2>)<EOL>m = GPy.models.SparseGPRegression(X, Y, kernel=rbf, num_inducing=num_inducing)<EOL>m['<STR_LIT>'] = <NUM_LIT><EOL>m.checkgrad()<EOL>if optimize:<EOL><INDENT>m.optimize('<STR_LIT>', messages=<NUM_LIT:1>, max_iters=max_iters)<EOL><DEDENT>if plot:<EOL><INDENT>m.plot()<EOL><DEDENT>print(m)<EOL>return m<EOL>
Run a 2D example of a sparse GP regression.