return pred_mean, pred_var if __name__ == '__main__': ''' If your implementations are correct, running python problem.py inside the Bayesian Regression directory will, for each sigma in sigmas_to-test generates plots ''' np.random.seed(46134) actual_weights = np.matrix([[0.3], [0.5]]) data_size = 40 noise = {"mean": 0, "var": 0.2**2} likelihood_var = noise["var"] xtrain, ytrain = support_code.generate_data(data_size, noise, actual_weights) #Question (b) sigmas_to_test = [1 / 2, 1 / (2**5), 1 / (2**10)] for sigma_squared in sigmas_to_test: prior = { "mean": np.matrix([[0], [0]]), "var": matlib.eye(2) * sigma_squared } support_code.make_plots(actual_weights, xtrain, ytrain, likelihood_var, prior, likelihood_func, get_posterior_params, get_predictive_params)
# TO DO return predMean, predVar if __name__ == '__main__': ''' If your implementations are correct, running python problem.py inside the Bayesian Regression directory will, for each sigma in sigmas_to-test generates plots ''' np.random.seed(46134) actual_weights = np.matrix([[0.3], [0.5]]) dataSize = 40 noise = {"mean": 0, "var": 0.2**2} likelihood_var = noise["var"] xtrain, ytrain = support_code.generateData(dataSize, noise, actual_weights) #Question (b) sigmas_to_test = [1 / 2, 1 / (2**5), 1 / (2**10)] for sigma_squared in sigmas_to_test: prior = { "mean": np.matrix([[0], [0]]), "var": matlib.eye(2) * sigma_squared } support_code.make_plots(actual_weights, xtrain, ytrain, likelihood_var, prior, likelihoodFunc, getPosteriorParams, getPredictiveParams)