ZhengyaoJiang / PGPortfolio

PGPortfolio: Policy Gradient Portfolio, the source code of "A Deep Reinforcement Learning Framework for the Financial Portfolio Management Problem"(https://arxiv.org/pdf/1706.10059.pdf).
GNU General Public License v3.0
1.74k stars 750 forks source link

Possible error in ReplayBuffer class init method #115

Open BruceDai003 opened 5 years ago

BruceDai003 commented 5 years ago

The original code I copy pasted here:

class ReplayBuffer:
    def __init__(self, start_index, end_index, batch_size, is_permed, coin_number, sample_bias=1.0):
        """
        :param start_index: start index of the training set on the global data matrices
        :param end_index: end index of the training set on the global data matrices
        """
        self.__coin_number = coin_number
        self.__experiences = [Experience(i) for i in range(start_index, end_index)]

I think it should be replaced with self.__experiences = [Experience(i) for i in range(start_index, end_index+1)], otherwise the length will be 1 item shorter than other objects, e.g., _train_indis from 0 to 32248.

dexhunter commented 4 years ago

I think end_index+1 makes sense @ZhengyaoJiang