plt.yticks(np.arange(0, 24 * 7, 24)) plt.xlabel(r'Time (hours)') plt.ylabel(r'Time (hours)') Sigma_pm10 = functions.covmat(acf_pm10, time[0:24 * 7]) plt.figure(figsize=(5, 4)) plt.imshow(Sigma_pm10, cmap='gray') plt.colorbar() plt.xticks(np.arange(0, 24 * 7, 24)) plt.yticks(np.arange(0, 24 * 7, 24)) plt.xlabel(r'Time (hours)') plt.ylabel(r'Time (hours)') xcf_no2 = signal.correlate(no2[0], no2[2]) Sigma_no2 = functions.xcovmat(xcf_no2, time[0:24], time[0:12]) plt.figure(figsize=(5, 4)) plt.imshow(Sigma_no2, cmap='gray') plt.colorbar() plt.xticks(np.arange(0, 24, 24)) plt.yticks(np.arange(0, 24, 24)) plt.xlabel(r'Time (hours)') plt.ylabel(r'Time (hours)') #xcf_no2_pm10_11 = signal.correlate(no2[0], pm10[0]) #Sigma_no2_pm10_11 = functions.xcovmat(xcf_no2_pm10_11, time[0:24*7], time[0:24*7]) # #plt.figure(figsize=(5,4)) #plt.imshow(Sigma_no2_pm10_11, cmap='gray') #plt.colorbar()
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_H[i, :, :], (this_mu_test_prior[i, :] - mu_test_prior[i, :])) this_cov_train_given_test[ i, :, :] = this_cov_train[i, :, :] - np.dot( this_H[i, :, :], this_cov_test_train[i, :, :]) # Update the posterior this_G[i, :, :] = this_cov_train_given_test[i, :, :] + np.dot(