Closed srozov closed 6 years ago
Hi there!
So to have time index you need to give index to every mini-batch. I don't think our current implementation include that. You can add an condition for next_experience_batch
function at replay_buffer.py
.
Just curious, are you trying to have a sequential training? (something like an epoch
)
I think you can get it from minot_axis of globaldata here. For example:
t = self.__global_data.minor_axis[indexs]
I didn't test that, you can refine it if there are bugs.
Thanks a lot for your replies! I was trying to do real-time testing. I'm updating the db every 5 min and taking the returns of __get_matrix_X()
and __get_matrix_y()
as inputs to calculate the portfolio weights (instead of [self._steps]
index I'm just using [-1]
.
I also modified __pack_samples(indexes)
so that the M matrix has only the last two necessary entries to calculate y. I just wanted to make sure that it is always taking the most recent entry in the db. It looks like it's working :)
I have one more question: are the coins that are displayed in the log (as in Selected coins are: ['...']
) in the same order as the portfolio weights ( as in the raw omega is [...]
) ? There is one more entry in this one, I assume the first is the BTC weight, and the rest is in the same order as in the first log entry, right?
There is one more entry in this one, I assume the first is the BTC weight, and the rest is in the same order as in the first log entry, right
I think you are right.
I just realised that the [self._steps]
does not represent the same time step t in __get_matrix_X()
and __get_matrix_y()
, as X = M[:, :, :, :-1]
takes a sliding window with all but the last value for the present step, but y = M[:, :, :, -1] / M[:, 0, None, :, -2]
uses data from the next (future) and present step. Is that so? Please correct me if I'm wrong. I find it confusing to calculate the price change at the end of the present step by using future data and not in the beginning of the next step by using data from present and past...
I find it confusing to calculate the price change at the end of the present step by using future data and not in the beginning of the next step by using data from present and past...
I'm not sure if I understand your question correctly, while I will try to answer that. Because you need to use the future price (y) to calculate the reward in this period.
This is not really an issue, but I'd like to find a way to reliably find the time indices of the values extracted from the database with
self.get_submatrix(index)
and__pack_samples(self, indexs)
. I understand that the time indices can be accessed withtimeindices = self.__global_data.minor_axis
, but how to do this inside the two previously mentioned methods? What I'm trying to do is basically find out to which time index each of these 'X' matrices belongs to: