MCPcopy Create free account
hub / github.com/Modulus-Labs/RockyBot / process_playground_task

Function process_playground_task

pytorch-model/process_dataset.py:167–264  ·  view source on GitHub ↗

Subject to change -- Ryan will mess with this until it works. Previously1: Classification task for {sparse, dense}-loss LSTM Previously2: Regression task for feedforward NN Currently: Classification task again for feedforward network

(idx_to_field_data, 
                            idx_to_field_labels, 
                            data_features, 
                            labels)

Source from the content-addressed store, hash-verified

165
166
167def process_playground_task(idx_to_field_data,
168 idx_to_field_labels,
169 data_features,
170 labels):
171 """
172 Subject to change -- Ryan will mess with this until it works.
173
174 Previously1: Classification task for {sparse, dense}-loss LSTM
175 Previously2: Regression task for feedforward NN
176 Currently: Classification task again for feedforward network
177 """
178
179 # --- Remove BTC prices from future and add in 1-hour-ahead data ---
180 idx_to_field_data, idx_to_field_labels, data_features, labels = \
181 preprocess_data(idx_to_field_data, idx_to_field_labels, data_features, labels)
182
183 # --- Cuts remainder of BTC features from features ---
184 data_features = np.transpose(np.transpose(data_features)[:-5])
185 idx_to_field_data = idx_to_field_data[:-5]
186
187 # --- Cuts everything but ETH prices from features ---
188 data_features = np.transpose(np.transpose(data_features)[:1])
189
190 # --- Creates new dataset by taking cuts from features ---
191 # (L, D) -- for LSTM
192 # new_data_features = list()
193 # for idx in range(len(data_features) - 36):
194 # new_data_features.append(data_features[idx:idx + 36])
195 # new_data_features = np.stack(new_data_features)
196 # labels = labels[:-36]
197 # print(new_data_features.shape)
198 # print(labels.shape)
199 # --------------------------------------------------------
200
201 # --- Creates new feature sets (Eth price DIFFS from 0-35 hours ago) ---
202 NUM_HOURS_BACK = 36
203 all_eth_hours_ago = list()
204 for ago in range(1, NUM_HOURS_BACK):
205 eth_hours_ago = np.transpose(data_features)[0][:-ago][NUM_HOURS_BACK - ago:]
206 eth_hours_ago = eth_hours_ago.reshape(1, len(eth_hours_ago))
207 all_eth_hours_ago.append(eth_hours_ago)
208
209 new_data_features = np.transpose(np.concatenate(
210 [np.transpose(data_features[NUM_HOURS_BACK:])] + all_eth_hours_ago
211 ))
212 labels = labels[NUM_HOURS_BACK:]
213
214 # --- Renormalizes each row ---
215 for idx in range(len(new_data_features)):
216 new_data_features[idx] = new_data_features[idx][0] - new_data_features[idx]
217
218 # ----------------------------------------------------------------
219
220 # --- Adding to the idx to field data ---
221 # for ago in range(1, 25):
222 # idx_to_field_data.append(f"Eth price {ago} hours ago")
223 # idx_to_field_data.append("eth_price_six_hours_ago")
224 # idx_to_field_data.append("eth_price_twelve_hours_ago")

Callers 1

process_dataset.pyFile · 0.85

Calls 1

preprocess_dataFunction · 0.85

Tested by

no test coverage detected