i have historical data of crypto as csv files, i have following code to train a model on…
- User
i have historical data of crypto as csv files, i have following code to train a model on them whithout merging them,:
import os import numpy as np import pandas as pd from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler
def data_generator(file_paths, batch_size, train=True, scaler=None): while True: # Loop forever so the generator never terminates
Shuffle file paths to ensure random distribution of data across files
np.random.shuffle(file_paths)
for file_path in file_paths: data = pd.read_csv(file_path)
Split features and labels
X = data.drop([ ‘Date’, ‘Symbol’, ‘y_High_1d’, ‘y_Low_1d’, ‘y_Priority_1d’, ‘y_High_2d’, ‘y_Low_2d’, ‘y_Priority_2d’, ‘y_High_3d’, ‘y_Low_3d’, ‘y_Priority_3d’, ‘y_High_5d’, ‘y_Low_5d’, ‘y_Priority_5d’], axis=1).values
y_high_1d = data[‘y_High_1d’].values y_low_1d = data[‘y_Low_1d’].values y_Priority_1d = data[‘y_Priority_1d’].values
y_high_2d = data[‘y_High_2d’].values y_low_2d = data[‘y_Low_2d’].values y_Priority_2d = data[‘y_Priority_2d’].values
y_high_3d = data[‘y_High_3d’].values y_low_3d = data[‘y_Low_3d’].values y_Priority_3d = data[‘y_Priority_3d’].values
y_high_5d = data[‘y_High_5d’].values y_low_5d = data[‘y_Low_5d’].values y_Priority_5d = data[‘y_Priority_5d’].values
Optionally, apply preprocessing here (e.g., Scaler transform)
if scaler is not None and train: X = scaler.fit_transform(X) elif scaler is not None: X = scaler.transform(X)
Splitting data into batches
for i in range(0, len(data), batch_size): end = i + batch_size X_batch = X[i:end]
y_high_batch_1d = y_high_1d[i:end] y_low_batch_1d = y_low_1d[i:end] y_priority_batch_1d = y_priority_1d[i:end]
y_high_batch_2d = y_high_2d[i:end] y_low_batch_2d = y_low_2d[i:end] y_priority_batch_2d = y_priority_2d[i:end]
y_high_batch_3d = y_high_3d[i:end] y_low_batch_3d = y_low_3d[i:end] y_priority_batch_3d = y_priority_3d[i:end]
y_high_batch_5d = y_high_5d[i:end] y_low_batch_5d = y_low_5d[i:end] y_priority_batch_5d = y_priority_5d[i:end]
yield X_batch, [y_high_batch_1d, y_low_batch_1d,y_priority_batch_1d, y_high_batch_2d, y_low_batch_2d,y_priority_batch_2d, y_high_batch_3d, y_low_batch_3d, y_priority_batch_3d, y_high_batch_5d, y_low_batch_5d, y_priority_batch_5d]
dataset_dir = r’F:\day_spot’ file_paths = [os.path.join(dataset_dir, file_name) for file_name in os.listdir(dataset_dir)] train_files, val_files = train_test_split(file_paths, test_size=0.06, random_state=42)
batch_size = 72
Optional: Initialize a scaler for data normalization
scaler = StandardScaler()
Create data generators
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.