huseinzol05 / Stock-Prediction-Models

Gathers machine learning and deep learning models for Stock forecasting including trading bots and simulations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to understand the code in realtime-evolution-strategy?

ppalantir opened this issue · comments

def get_state(parameters, t, window_size = 20): outside = [] d = t - window_size + 1 for parameter in parameters: block = ( parameter[d : t + 1] if d >= 0 else -d * [parameter[0]] + parameter[0 : t + 1] ) res = [] for i in range(window_size - 1): res.append(block[i + 1] - block[i]) for i in range(1, window_size, 1): res.append(block[i] - block[0]) outside.append(res) return np.array(outside).reshape((1, -1))

my question is why define state as this format?
is there any reference for helping understanding this?