(-6, -12, -18, -24) hour ETH price dataset which asks network to predict, for each bucket of time period (hour, day, week), whether/how much future ETH prices will go up or down.
(idx_to_field_data,
idx_to_field_labels,
data_features,
labels)
| 265 | |
| 266 | |
| 267 | def process_classification_task(idx_to_field_data, |
| 268 | idx_to_field_labels, |
| 269 | data_features, |
| 270 | labels): |
| 271 | """ |
| 272 | (-6, -12, -18, -24) hour ETH price dataset which asks network to predict, for each bucket of |
| 273 | time period (hour, day, week), whether/how much future ETH prices will |
| 274 | go up or down. |
| 275 | """ |
| 276 | |
| 277 | # --- Remove BTC prices from future and add in 6-hours-ahead data --- |
| 278 | idx_to_field_data, idx_to_field_labels, data_features, labels = preprocess_data(idx_to_field_data, |
| 279 | idx_to_field_labels, |
| 280 | data_features, |
| 281 | labels) |
| 282 | |
| 283 | # --- Creates new feature sets (Eth price from 1-24 hours ago) --- |
| 284 | all_eth_hours_ago = list() |
| 285 | for ago in range(1, 25): |
| 286 | eth_hours_ago = np.transpose(data_features)[0][:-ago][24 - ago:] |
| 287 | eth_hours_ago = eth_hours_ago.reshape(1, len(eth_hours_ago)) |
| 288 | all_eth_hours_ago.append(eth_hours_ago) |
| 289 | |
| 290 | # eth_six_hours_ago = np.transpose(data_features)[0][:-6][18:] |
| 291 | # eth_twelve_hours_ago = np.transpose(data_features)[0][:-12][12:] |
| 292 | # eth_eighteen_hours_ago = np.transpose(data_features)[0][:-18][6:] |
| 293 | # eth_twentyfour_hours_ago = np.transpose(data_features)[0][:-24] |
| 294 | |
| 295 | # eth_six_hours_ago = eth_six_hours_ago.reshape(1, len(eth_six_hours_ago)) |
| 296 | # eth_twelve_hours_ago = eth_twelve_hours_ago.reshape(1, len(eth_twelve_hours_ago)) |
| 297 | # eth_eighteen_hours_ago = eth_eighteen_hours_ago.reshape(1, len(eth_eighteen_hours_ago)) |
| 298 | # eth_twentyfour_hours_ago = eth_twentyfour_hours_ago.reshape(1, len(eth_twentyfour_hours_ago)) |
| 299 | |
| 300 | data_features = np.transpose(np.concatenate( |
| 301 | [np.transpose(data_features[24:])] + all_eth_hours_ago |
| 302 | |
| 303 | )) |
| 304 | labels = labels[24:] |
| 305 | |
| 306 | # --- Adding to the idx to field data --- |
| 307 | for ago in range(1, 25): |
| 308 | idx_to_field_data.append(f"Eth price {ago} hours ago") |
| 309 | # idx_to_field_data.append("eth_price_six_hours_ago") |
| 310 | # idx_to_field_data.append("eth_price_twelve_hours_ago") |
| 311 | # idx_to_field_data.append("eth_price_eighteen_hours_ago") |
| 312 | # idx_to_field_data.append("eth_price_twentyfour_hours_ago") |
| 313 | |
| 314 | # --- Picks ONLY the 6-hours-ahead price data delta as labels --- |
| 315 | labels = np.transpose(labels)[3] - np.transpose(labels)[0] |
| 316 | six_hour_hist_bins = [-1800, -100, -50, -30, -15, -5, 0, 5, 15, 30, 50, 100, 1800] |
| 317 | new_labels = list() |
| 318 | for label_idx, label in enumerate(labels): |
| 319 | for bin_idx in range(len(six_hour_hist_bins) - 1): |
| 320 | if label >= six_hour_hist_bins[bin_idx] and label < six_hour_hist_bins[bin_idx + 1]: |
| 321 | new_labels.append(bin_idx) |
| 322 | break |
| 323 | |
| 324 | new_labels = np.asarray(new_labels, dtype=np.int64) |
nothing calls this directly
no test coverage detected