def run_without_offloading(cell_list):
    def run(cell_num):
        config = Env_Config()
        model_path = os.path.join(root_dir,
                                  'offloading/output_model/deepQ_test.ckpt')
        offloading = Run_Offloading(model_path, config, cell_num)
        result_dict = offloading.run_test_without_RL(0)
        result_array = dict_to_nparray(result_dict, cell_num)

        return result_array

    target_path = os.path.join(
        root_dir, 'offloading/result/without_offloading_without_RL')
    utility.check_path_exist(target_path)
    store_path = os.path.join(target_path, 'loop_report.txt')
    if os.path.exists(store_path):
        os.remove(store_path)
    cell_list_len = len(cell_list)
    all_cell_result_array_list = []

    for cell_num in cell_list:
        logger.info('cell_num:{}'.format(cell_num))
        result_array = run(cell_num)
        all_cell_result_array_list.append(result_array)
        save_report(result_array, store_path)
        all_cell_result_array = np.stack(all_cell_result_array_list, axis=0)
        du.save_array(all_cell_result_array,
                      os.path.join(target_path, 'all_cell_result_array.npy'))
    all_cell_result_array = np.stack(all_cell_result_array_list, axis=0)
    du.save_array(all_cell_result_array,
                  os.path.join(target_path, 'all_cell_result_array.npy'))
    plt.ioff()
Esempio n. 2
0
    def _task_4():
        '''
                X: past one hour
                Y: next hour's min value
        '''
        x_target_path = './npy/final/hour_min/testing/X'
        y_target_path = './npy/final/hour_min/testing/Y'
        if not os.path.exists(x_target_path):
            os.makedirs(x_target_path)
        if not os.path.exists(y_target_path):
            os.makedirs(y_target_path)
        filelist = du.list_all_input_file(root_dir + '/npy/hour_min/X')
        filelist.sort()

        for i, filename in enumerate(filelist):
            if filename != 'training_raw_data.npy':
                data_array = du.load_array(root_dir + '/npy/hour_min/X/' +
                                           filename)
                # only network activity
                data_array = data_array[:, :, grid_start:grid_stop,
                                        grid_start:grid_stop, (0, 1, -1)]
                print('saving array shape:{}'.format(data_array.shape))
                du.save_array(data_array,
                              x_target_path + '/hour_min_' + str(i))

        filelist = du.list_all_input_file(root_dir + '/npy/hour_min/Y')
        filelist.sort()
        for i, filename in enumerate(filelist):
            min_array = du.load_array(root_dir + '/npy/hour_min/Y/' + filename)
            # only network activity
            min_array = min_array[:, :, grid_start:grid_stop,
                                  grid_start:grid_stop, (0, 1, -1)]
            du.save_array(min_array, y_target_path + '/hour_min_' + str(i))
Esempio n. 3
0
	def _get_10mins_CDR_internet_traffic(self, grid_list, reload=True):
		target_path = './npy/10min_CDR_internet_traffic_temp.npy'
		source_path = os.path.join(self.config.base_dir, '10min_CDR_internet_traffic.npy')
		if reload:
			# TK = Prepare_Task_Data('./npy/final/')
			# X_array, _ = TK.Task_max(grid_limit=[(0, 100), (0, 100)], generate_data=True)  # only need max here
			X_array = du.load_array(source_path)
			X_array = np.transpose(X_array, (2, 3, 0, 1, 4))
			array_list = []
			for search_grid_id in grid_list:
				# row, column = compute_row_col(grid_id)
				for row_index in range(X_array.shape[0]):
					for col_index in range(X_array.shape[1]):
						grid_id = X_array[row_index, col_index, 0, 0, 0]
						if search_grid_id == grid_id:
							new_x = X_array[row_index, col_index]
							new_x = new_x[:, :, (0, 1, -1)]
							array_list.append(new_x)  # grid_id, timestamp, internet traffic
			_10mins_CDR_internet_traffic = np.stack(array_list)
			logger.debug('_10mins_CDR_internet_traffic shape:{}'.format(_10mins_CDR_internet_traffic.shape))  # (grid_number, 1487, 6, 3)
			du.save_array(_10mins_CDR_internet_traffic, target_path)
		else:
			_10mins_CDR_internet_traffic = du.load_array(target_path)

		return _10mins_CDR_internet_traffic
def run_ARIMA_prediction_RL(cell_list):
    def run_offloading(cell_num):
        config = Env_Config()
        config.features_num = 3
        config.base_dir = os.path.join(root_dir,
                                       'offloading/npy/real_prediction_ARIMA')
        model_path = os.path.join(
            root_dir, 'offloading/output_model/deepQ_RL_ARIMA_prediction.ckpt')
        offloading = Run_Offloading(model_path, config, cell_num)
        without_RL_with_offloading_result_dict = offloading.run_test_without_RL(
            10)
        without_RL_offloading_result_dict = offloading.run_test_without_RL(0)

        logger.info(
            'macro load:{} offloading_without_RL:{} without_RL_without_offloading:{}'
            .format(
                np.mean(
                    without_RL_offloading_result_dict['macro_load'][-149:]),
                np.mean(without_RL_with_offloading_result_dict['energy_effi']
                        [-149:]),
                np.mean(
                    without_RL_offloading_result_dict['energy_effi'][-149:])))
        offloading.RL_train()
        with_RL_result_dict = offloading.run_test_with_RL(reload=False)
        with_RL_result_array = dict_to_nparray(with_RL_result_dict, cell_num)
        # without_RL_with_offloading_result_array = dict_to_nparray(without_RL_with_offloading_result_dict)
        # without_RL_offloading_result_array = dict_to_nparray(without_RL_offloading_result_dict)
        offloading_plot(with_RL_result_dict,
                        without_RL_with_offloading_result_dict,
                        without_RL_offloading_result_dict)
        return with_RL_result_array

    plt.ion()
    target_path = os.path.join(root_dir,
                               'offloading/result/RL_real_ARIMA_prediction')
    utility.check_path_exist(target_path)
    store_path = os.path.join(target_path, 'loop_report.txt')
    if os.path.exists(store_path):
        os.remove(store_path)

    cell_list_len = len(cell_list)
    all_cell_result_array_list = []
    for cell_num in cell_list:

        with_RL_result_array = run_offloading(cell_num)
        all_cell_result_array_list.append(with_RL_result_array)
        logger.info('cell_num:{} average effi mean:{}'.format(
            cell_num, np.mean(with_RL_result_array[-149:, 2])))
        save_report(with_RL_result_array, store_path)
        all_cell_result_array = np.stack(all_cell_result_array_list, axis=0)
        du.save_array(all_cell_result_array,
                      os.path.join(target_path, 'all_cell_result_array.npy'))

    all_cell_result_array = np.stack(all_cell_result_array_list, axis=0)
    du.save_array(all_cell_result_array,
                  os.path.join(target_path, 'all_cell_result_array.npy'))
    plt.ioff()
Esempio n. 5
0
def convert_prediction_to_non_prediction():
	source_path = os.path.join(root_dir, 'offloading/npy/real_prediction')
	target_path = os.path.join(root_dir, 'offloading/npy/real_without_prediction')

	_10_min_traffic = du.load_array(os.path.join(source_path, '10min_CDR_internet_traffic.npy'))
	hour_traffic = du.load_array(os.path.join(source_path, 'hour_traffic_array.npy'))
	print('origin 10 min shape:{} origin hour shape:{}'.format(_10_min_traffic.shape, hour_traffic.shape))

	_10_min_traffic = _10_min_traffic[1:]  # (1485, 6, 41, 41, 3)
	hour_traffic = hour_traffic[:-1]  # (1485, 1, 41, 41, 8)
	print('new 10 min shape:{} new hour shape:{}'.format(_10_min_traffic.shape, hour_traffic.shape))
	du.save_array(_10_min_traffic, os.path.join(target_path, '10min_CDR_internet_traffic'))
	du.save_array(hour_traffic, os.path.join(target_path, 'hour_traffic_array'))
Esempio n. 6
0
 def load_and_save(file_dir, target_path):
     filelist = du.list_all_input_file(file_dir)
     filelist.sort()
     for i, filename in enumerate(filelist):
         file_path = os.path.join(file_dir, filename)
         data_array = du.load_array(file_path)
         data_array = data_array[:, :,
                                 grid_limit[0][0]:grid_limit[0][1],
                                 grid_limit[1][0]:grid_limit[1][1],
                                 (0, 1, -1)]
         print('saving array shape:', data_array.shape)
         du.save_array(
             data_array,
             os.path.join(target_path, task_name + '_' + str(i)))
Esempio n. 7
0
    def Task_max_min_avg(self,
                         grid_limit=[(45, 60), (45, 60)],
                         generate_data=False):
        # print(grid_limit)
        task_name = 'hour_min_avg_max'
        if generate_data:
            x_target_path = os.path.join(self.target_path, task_name, 'X')
            y_target_path = os.path.join(self.target_path, task_name, 'Y')
            if not os.path.exists(x_target_path):
                os.makedirs(x_target_path)
            if not os.path.exists(y_target_path):
                os.makedirs(y_target_path)
            X, max_Y = self.Task_max(grid_limit, generate_data)
            _, min_Y = self.Task_min(grid_limit, generate_data)
            _, avg_Y = self.Task_avg(grid_limit, generate_data)
            min_avg_max_Y = np.zeros([
                max_Y.shape[0], max_Y.shape[1], max_Y.shape[2], max_Y.shape[3],
                5
            ])  # grid_id timestamp, min, avg, max

            for i in range(max_Y.shape[0]):
                for j in range(max_Y.shape[1]):
                    for row in range(max_Y.shape[2]):
                        for col in range(max_Y.shape[3]):
                            # print('min:{} avg:{} max:{}'.format(min_Y[i, j, row, col, 0], avg_Y[i, j, row, col, 0], max_Y[i, j, row, col, 0]))
                            min_avg_max_Y[i, j, row, col,
                                          0] = min_Y[i, j, row, col,
                                                     0]  # grid_id
                            min_avg_max_Y[i, j, row, col,
                                          1] = min_Y[i, j, row, col,
                                                     1]  # timesatemp

                            min_avg_max_Y[i, j, row, col,
                                          2] = min_Y[i, j, row, col,
                                                     -1]  # internet traffic
                            min_avg_max_Y[i, j, row, col,
                                          3] = avg_Y[i, j, row, col,
                                                     -1]  # internet traffic
                            min_avg_max_Y[i, j, row, col,
                                          4] = max_Y[i, j, row, col,
                                                     -1]  # internet traffic
            du.save_array(X, os.path.join(x_target_path, 'min_avg_max_X'))
            du.save_array(min_avg_max_Y,
                          os.path.join(y_target_path, 'min_avg_max_Y'))
            return X, min_avg_max_Y
        else:
            return self._get_X_and_Y(task_name)
Esempio n. 8
0
    def _task_6():
        '''
                X: past one hour
                Y: next 10 minutes traffic level
        '''
        _task_2()
        x_target_path = './npy/final/10_minutes_level/testing/X'
        y_target_path = './npy/final/10_minutes_level/testing/Y'
        if not os.path.exists(x_target_path):
            os.makedirs(x_target_path)
        if not os.path.exists(y_target_path):
            os.makedirs(y_target_path)

        X, Y = get_X_and_Y_array(task_num=2)
        Y = feature_scaling(Y, feature_range=(1, 10))  # 10 interval
        Y = np.floor(Y)  # 10 level
        du.save_array(X, x_target_path + '/10_minutes_X')
        du.save_array(Y, y_target_path + '/10_minutes_Y')
Esempio n. 9
0
    def _task_5():
        '''
                X: past one hour
                Y: next hour's min avg max internet traffic
                for multi task learning
        '''
        _task_4()
        _task_3()
        _task_1()
        x_target_path = './npy/final/hour_min_avg_max/testing/X'
        y_target_path = './npy/final/hour_min_avg_max/testing/Y'
        if not os.path.exists(x_target_path):
            os.makedirs(x_target_path)
        if not os.path.exists(y_target_path):
            os.makedirs(y_target_path)

        max_X, max_Y = get_X_and_Y_array(task_num=1)
        min_X, min_Y = get_X_and_Y_array(task_num=4)
        avg_X, avg_Y = get_X_and_Y_array(task_num=3)
        min_avg_max_Y = np.zeros([
            max_Y.shape[0], max_Y.shape[1], max_Y.shape[2], max_Y.shape[3], 5
        ])  # grid_id timestamp, min, avg, max

        for i in range(max_Y.shape[0]):
            for j in range(max_Y.shape[1]):
                for row in range(max_Y.shape[2]):
                    for col in range(max_Y.shape[3]):
                        # print('min:{} avg:{} max:{}'.format(min_Y[i, j, row, col, 0], avg_Y[i, j, row, col, 0], max_Y[i, j, row, col, 0]))
                        min_avg_max_Y[i, j, row, col, 0] = min_Y[i, j, row,
                                                                 col, 0]
                        min_avg_max_Y[i, j, row, col, 1] = min_Y[i, j, row,
                                                                 col, 1]

                        min_avg_max_Y[i, j, row, col, 2] = min_Y[i, j, row,
                                                                 col, -1]
                        min_avg_max_Y[i, j, row, col, 3] = avg_Y[i, j, row,
                                                                 col, -1]
                        min_avg_max_Y[i, j, row, col, 4] = max_Y[i, j, row,
                                                                 col, -1]
        du.save_array(max_X, x_target_path + '/min_avg_max_X')
        du.save_array(min_avg_max_Y, y_target_path + '/min_avg_max_Y')
Esempio n. 10
0
def generate_real_prediction_traffic_array():
	'''
		call generate_new_real_prediction_traffic_array and generate_new_10mins_CDR_internet_traffic
	'''
	targer_dir = os.path.join(root_dir, 'offloading/npy/real_prediction')
	CNN_RNN.utility.check_path_exist(targer_dir)
	hour_target_path = os.path.join(targer_dir, 'hour_traffic_array.npy')
	_10mins_target_path = os.path.join(targer_dir, '10min_CDR_internet_traffic.npy')

	hour_traffic = generate_new_real_prediction_traffic_array()  # (1487, 1, 41, 41, 8)
	_10_min_traffic = generate_new_10mins_CDR_internet_traffic()  # (1487, 6, 41, 41, 3)

	_10_min_traffic = _10_min_traffic[1:]  # (1486, 6, 41, 41, 3)
	hour_traffic = hour_traffic[:-1]  # (1486, 1, 41, 41, 8)
	print('hour_traffic shape:{} _10_min_traffic shape:{}'.format(hour_traffic.shape, _10_min_traffic.shape))

	# for row_index in range(hour_traffic.shape[2]):
	# 	for col_index in range(hour_traffic.shape[3]):
	# 		print(hour_traffic[0, 0, row_index, col_index, 0])
	du.save_array(hour_traffic, hour_target_path)
	du.save_array(_10_min_traffic, _10mins_target_path)
Esempio n. 11
0
def predict_MTL_train(neural, X_array, Y_array, model_path):
    print(X_array.shape)

    prediction_min, prediction_avg, prediction_max = neural.start_MTL_predict(
        X_array, Y_array[:, :, :, :, 2:], model_path)
    # real_min = Y_array[:, :, :, :, 2, np.newaxis]
    # real_avg = Y_array[:, :, :, :, 3, np.newaxis]
    # real_max = Y_array[:, :, :, :, 4, np.newaxis]
    # print(prediction_min.shape, real_min.shape)
    ''' unfeature scaling'''
    predict_y = np.concatenate(
        (prediction_min, prediction_avg, prediction_max), axis=-1)
    predict_y = un_feature_scaling(predict_y, scaler)
    new_Y_array = un_feature_scaling(Y_array[:, :, :, :, 2:], scaler)
    Y_array = copy(Y_array, new_Y_array)

    # grid_id, timestamp, real_min, real_avg, real_max, prediciton_min, prediction_avg, prediction_max
    Y_real_prediction = np.concatenate((Y_array, predict_y), axis=-1)
    du.save_array(Y_real_prediction, './result/Y_real_prediction.npy')

    print('-' * 20, 'task min:', '-' * 20)
    compute_loss_rate(Y_array[:, :, :, :, 2, np.newaxis],
                      predict_y[:, :, :, :, 0, np.newaxis])
    plot_predict_vs_real(Y_array[:, :, :, :, (0, 1, 2)],
                         predict_y[:, :, :, :, 0, np.newaxis])
    print('-' * 30)
    print('-' * 20, 'task avg:', '-' * 20)
    compute_loss_rate(Y_array[:, :, :, :, 3, np.newaxis],
                      predict_y[:, :, :, :, 1, np.newaxis])
    plot_predict_vs_real(Y_array[:, :, :, :, (0, 1, 3)],
                         predict_y[:, :, :, :, 1, np.newaxis])
    print('-' * 30)
    print('-' * 20, 'task max:', '-' * 20)
    compute_loss_rate(Y_array[:, :, :, :, 4, np.newaxis],
                      predict_y[:, :, :, :, 2, np.newaxis])
    plot_predict_vs_real(Y_array[:, :, :, :, (0, 1, 4)],
                         predict_y[:, :, :, :, 2, np.newaxis])
    print('-' * 30)
Esempio n. 12
0
    def _task_3():
        '''
                X: past one hour
                Y: next hour's avg value
        '''
        x_target_path = './npy/final/hour_avg/testing/X'
        y_target_path = './npy/final/hour_avg/testing/Y'
        if not os.path.exists(x_target_path):
            os.makedirs(x_target_path)
        if not os.path.exists(y_target_path):
            os.makedirs(y_target_path)

        filelist = du.list_all_input_file(root_dir + '/npy/hour_avg/X')
        filelist.sort()
        for i, filename in enumerate(filelist):
            if filename != 'training_raw_data.npy':
                data_array = du.load_array(root_dir + '/npy/hour_avg/X/' +
                                           filename)

                data_array = data_array[:, :, grid_start:grid_stop,
                                        grid_start:grid_stop, (0, 1, -1)]
                print('saving array shape:', data_array.shape)
                du.save_array(data_array,
                              x_target_path + '/hour_avg_' + str(i))

                # prepare y
                filelist = du.list_all_input_file(root_dir + '/npy/hour_avg/Y')
                filelist.sort()
                for i, filename in enumerate(filelist):
                    avg_array = du.load_array(root_dir + '/npy/hour_avg/Y/' +
                                              filename)
                    # only network activity
                    # avg_array = avg_array[:, :, grid_start:65, grid_start:65,
                    # (0, 1, -1)]  # only network activity
                    avg_array = avg_array[:, :, grid_start:grid_stop,
                                          grid_start:grid_stop, (0, 1, -1)]
                    du.save_array(avg_array,
                                  y_target_path + '/hour_avg_' + str(i))
Esempio n. 13
0
    def _task_2():
        '''
        rolling 10 minutes among timeflows
                X: past one hour
                Y: next 10 minutes value
        '''
        # check target dir exist
        x_target_path = './npy/final/roll_10/testing/X'
        y_target_path = './npy/final/roll_10/testing/Y'
        if not os.path.exists(x_target_path):
            os.makedirs(x_target_path)
        if not os.path.exists(y_target_path):
            os.makedirs(y_target_path)

        filelist_X = du.list_all_input_file(root_dir + '/npy/npy_roll/X/')
        filelist_Y = du.list_all_input_file(root_dir + '/npy/npy_roll/Y/')
        filelist_X.sort()
        filelist_Y.sort()
        for i, filename in enumerate(filelist_X):
            data_array = du.load_array(root_dir + '/npy/npy_roll/X/' +
                                       filename)

            data_array = data_array[:, :, grid_start:grid_stop,
                                    grid_start:grid_stop, (0, 1, -1)]
            print('saving  array shape:{}'.format(data_array.shape))
            du.save_array(data_array, x_target_path + '/X_' + str(i))

        for i, filename in enumerate(filelist_Y):
            data_array = du.load_array(root_dir + '/npy/npy_roll/Y/' +
                                       filename)

            # only network activity
            data_array = data_array[:, :, grid_start:grid_stop,
                                    grid_start:grid_stop, (0, 1, -1)]
            print(data_array[0, 0, 20, 20, 0])
            print('saving  array shape:{}'.format(data_array.shape))
            du.save_array(data_array, y_target_path + '/Y_' + str(i))
Esempio n. 14
0
def evaluate_CNN_RNN_without_task():
    def search_grid(data_array, grid_id):
        array = np.transpose(data_array, (2, 3, 0, 1, 4))
        for row in range(array.shape[0]):
            for col in range(array.shape[1]):
                if grid_id == array[row, col, 0, 0, 0]:
                    return row, col
        return 0, 0

    def get_data():
        method_result_path = os.path.join(
            root_dir,
            'CNN_RNN/result/CNN_RNN_without_task/all_real_prediction_traffic_array.npy'
        )
        result_array = du.load_array(method_result_path)

        row_center_list = list(range(40, 80, 3))
        col_center_list = list(range(30, 70, 3))
        row_range = range(row_center_list[0] - 1, row_center_list[-1] + 1)
        col_range = range(col_center_list[0] - 1, col_center_list[-1] + 1)
        logger.info('row_range {}:{} col_range: {}:{}'.format(
            row_range[0], row_range[-1], col_range[0], col_range[-1]))
        result_array = result_array[:-1, :, :row_range[-1] - row_range[0] +
                                    1, :col_range[-1] - col_range[0] + 1]
        logger.debug('result_array shape:{}'.format(result_array.shape))
        return result_array

    def evaluate_performance(real, prediction):
        # data_array_len = real.shape[0]

        # test_real = real[9 * data_array_len // 10:]
        # test_prediction = prediction[9 * data_array_len // 10:]

        MAPE_loss = utility.MAPE_loss(real, prediction)
        AE_loss = utility.AE_loss(real, prediction)
        RMSE_loss = utility.RMSE_loss(real, prediction)
        # MAPE_train = utility.MAPE_loss(train_array[:, :, :, :, 2, np.newaxis], train_array[:, :, :, :, 3, np.newaxis])
        # print('test accu:{} test AE:{} test RMSE:{}'.format(1 - MAPE_test, AE_test, RMSE_test))
        return 1 - MAPE_loss, AE_loss, RMSE_loss

    def calculate_min_avg_max(data_array):
        new_data_array = np.zeros(
            (data_array.shape[0], 1, 100, 100, 8)
        )  # hour, 1, row, col, (grid_id, timestmap, real_min, real_avg, real_max, preidiction_min, prediction_avg, prediction_max)
        data_array = np.transpose(
            data_array, (0, 2, 3, 1, 4))  # hour, row, col, 10min, feature
        for i in range(data_array.shape[0]):
            for row in range(data_array.shape[1]):
                for col in range(data_array.shape[2]):
                    real_max_value = np.amax(data_array[i, row, col, :, 2])
                    prediction_max_value = np.amax(data_array[i, row, col, :,
                                                              3])

                    real_min_value = np.amin(data_array[i, row, col, :, 2])
                    prediction_min_value = np.amin(data_array[i, row, col, :,
                                                              3])

                    real_avg_value = np.mean(data_array[i, row, col, :, 2])
                    prediction_avg_value = np.mean(data_array[i, row, col, :,
                                                              3])

                    grid_id = data_array[i, row, col, 0, 0]
                    timestamp = data_array[i, row, col, 0, 1]
                    row_index, col_index = utility.compute_row_col(grid_id)
                    new_data_array[i, 0, row_index, col_index, 0] = grid_id
                    new_data_array[i, 0, row_index, col_index, 1] = timestamp
                    new_data_array[i, 0, row_index, col_index,
                                   2] = real_min_value
                    new_data_array[i, 0, row_index, col_index,
                                   3] = real_avg_value
                    new_data_array[i, 0, row_index, col_index,
                                   4] = real_max_value
                    new_data_array[i, 0, row_index, col_index,
                                   5] = prediction_min_value
                    new_data_array[i, 0, row_index, col_index,
                                   6] = prediction_avg_value
                    new_data_array[i, 0, row_index, col_index,
                                   7] = prediction_max_value
                    # logger.info('grid_id:{} real:{} prediction:{}'.format(int(grid_id), real_max_value, prediction_max_value))

        return new_data_array

    def plot_CNN_RNN_without_task(data_arrray, grid_id, interval=6):
        logger.debug('data_arrray :{}'.format(data_arrray.shape))
        # plot_row = 10
        # plot_col = 30
        plot_row, plot_col = search_grid(data_arrray, grid_id)
        # result_array_len = result_array.shape[0]
        logger.info('plot_row:{} plot_col:{}'.format(plot_row, plot_col))
        plot_real = data_arrray[:, :, plot_row, plot_col, 2].reshape(-1, 1)
        plot_prediction = data_arrray[:, :, plot_row, plot_col,
                                      3].reshape(-1, 1)
        plt_info = data_arrray[:, :, plot_row, plot_col, :2].reshape(-1, 2)
        report_func.plot_predict_vs_real(plt_info, plot_real, plot_prediction,
                                         'CNN-RNN(*) prediction on ', interval)

    def evaluate_one_grid(origin_array, real_preidction, grid_id=4867):
        logger.info('origin_array shape:{} real_preidction shape:{}'.format(
            origin_array.shape, real_preidction.shape))
        plot_CNN_RNN_without_task(origin_array[-149:], grid_id, 24)
        row, col = search_grid(real_preidction, grid_id)

        accu_min, AE_min, RMSE_min = evaluate_performance(
            real_preidction[-149:, :, row:row + 1, col:col + 1, 2],
            real_preidction[-149:, :, row:row + 1, col:col + 1, 5])
        accu_avg, AE_avg, RMSE_avg = evaluate_performance(
            real_preidction[-149:, :, row:row + 1, col:col + 1, 3],
            real_preidction[-149:, :, row:row + 1, col:col + 1, 6])
        accu_max, AE_max, RMSE_max = evaluate_performance(
            real_preidction[-149:, :, row:row + 1, col:col + 1, 4],
            real_preidction[-149:, :, row:row + 1, col:col + 1, 7])
        logger.info('grid id:{} MIN accu:{} AE:{} RMSE:{}'.format(
            grid_id, accu_min, AE_min, RMSE_min))
        logger.info('grid id:{} AVG accu:{} AE:{} RMSE:{}'.format(
            grid_id, accu_avg, AE_avg, RMSE_avg))
        logger.info('grid id:{} MAX accu:{} AE:{} RMSE:{}'.format(
            grid_id, accu_max, AE_max, RMSE_max))

        plot_CNN_RNN_without_task(
            real_preidction[-149:, :, :, :, (0, 1, 4, 7)], grid_id, 2)

    reload = None
    result_array = get_data()
    accu, AE, RMSE = evaluate_performance(result_array[-149:, :, :, :, 2],
                                          result_array[-149:, :, :, :, 3])
    logger.info('total data: test accu:{} test AE:{} test RMSE:{}'.format(
        accu, AE, RMSE))
    if reload:
        real_preidction = calculate_min_avg_max(result_array)
        du.save_array(
            real_preidction,
            os.path.join(
                root_dir,
                'CNN_RNN/result/CNN_RNN_without_task/all_real_prediction_traffic_array_split_min_avg_max.npy'
            ))
    else:
        real_preidction = du.load_array(
            os.path.join(
                root_dir,
                'CNN_RNN/result/CNN_RNN_without_task/all_real_prediction_traffic_array_split_min_avg_max.npy'
            ))
    print()
    accu_min, AE_min, RMSE_min = evaluate_performance(
        real_preidction[-149:, :, :, :, 2], real_preidction[-149:, :, :, :, 5])
    accu_avg, AE_avg, RMSE_avg = evaluate_performance(
        real_preidction[-149:, :, :, :, 3], real_preidction[-149:, :, :, :, 6])
    accu_max, AE_max, RMSE_max = evaluate_performance(
        real_preidction[-149:, :, :, :, 4], real_preidction[-149:, :, :, :, 7])
    logger.info('MIN accu:{} AE:{} RMSE:{}'.format(accu_min, AE_min, RMSE_min))
    logger.info('AVG accu:{} AE:{} RMSE:{}'.format(accu_avg, AE_avg, RMSE_avg))
    logger.info('MAX accu:{} AE:{} RMSE:{}'.format(accu_max, AE_max, RMSE_max))

    evaluate_one_grid(result_array, real_preidction, 4867)
    plt.show()