this_residual = np.empty((5, BATCH_SIZE)) this_coefficient = np.empty((5, 24, BATCH_SIZE)) this_mu_test_posterior = np.empty((5, 24)) this_cov_test_posterior = np.empty((5, 24, 24)) for iteration in range(MAX_ITERATION): this_train_index = np.arange(TOTAL_SIZE - (iteration + 1) * BATCH_SIZE, TOTAL_SIZE - iteration * BATCH_SIZE) this_time_train = time_train[this_train_index] this_data_train = data_train[:, this_train_index] # Marginal distribution of the k-th segment of data for i in range(5): this_mu_train[i, :] = functions.meanvec(mean_busday[i, :], mean_holiday[i, :], this_time_train) # Conditional distribution of the k-th segment of data for i in range(5): this_cov_train[i, :, :] = functions.covmat(acf[i, :], this_time_train) this_cov_train_test[i, :, :] = functions.xcovmat( acf[i, :], this_time_train, time_test) this_cov_test_train[i, :, :] = np.transpose( this_cov_train_test[i, :, :]) this_H[i, :, :] = np.dot(this_cov_train_test[i, :, :], np.linalg.inv(cov_test_prior[i, :, :])) this_mu_train_given_test[i, :] = this_mu_train[i, :] + np.dot(
this_cov_train_given_test = np.empty((5, BATCH_SIZE, BATCH_SIZE)) this_H = np.empty((5, BATCH_SIZE, 24)) this_G = np.empty((5, BATCH_SIZE, BATCH_SIZE)) this_residual = np.empty((5, BATCH_SIZE)) this_mu_test_posterior = np.empty((5, 24)) this_cov_test_posterior = np.empty((5, 24, 24)) for iteration in range(MAX_ITERATION): this_train_index = np.arange(TOTAL_SIZE - (iteration + 1) * BATCH_SIZE, TOTAL_SIZE - iteration * BATCH_SIZE) this_time_train = time_train[this_train_index] this_data_train = data_train[:, this_train_index] this_mu_train = functions.meanvec(mean_busday, mean_holiday, this_time_train) for i in range(5): this_cov_train[i, :, :] = functions.covmat(acf[i, :], this_time_train) this_cov_train_test[i, :, :] = functions.xcovmat( acf[i, :], this_time_train, time_test) this_cov_test_train[i, :, :] = np.transpose( this_cov_train_test[i, :, :]) # Conditional distribution for the k-th segment of data this_mu_train_given_test[i, :] = this_mu_train[i, :] + np.dot( np.dot(this_cov_train_test[i, :, :], np.linalg.inv(cov_test_prior[i, :, :])), (this_mu_test_prior[i, :] - mu_test_prior[i, :])) this_cov_train_given_test[i, :, :] = this_cov_train[i, :, :] - np.dot( np.dot(this_cov_train_test[i, :, :],