i haver bunch of csv files as my dataset... I want to train a standard deep learning…
- User
i haver bunch of csv files as my dataset... I want to train a standard deep learning model on my dataset whithout merging them together give me proper python code
- Assistant
- User
how should i know number_of_training_samples and number_of_validation_samples
- Assistant
To determine
number_of_training_samplesandnumber_of_validation_samples, especially when you're dealing with multiple CSV files and using a data generator, you should calculate these numbers in advance. One straightforward way is to iterate through your dataset files separately for training and validation sets and count the total number of rows (samples) in these files, excluding the header rows if present. Here is how you can do it: - User
but you splited train and val files as : train_files, val_files = train_test_split(file_paths, test_size=0.2, random_state=42)
- Assistant
You're right, my previous explanation and subsequent code snippet for counting samples assumed static lists for training and validation files, which might have caused confusion. Let's integrate the file splitting directly with the counting of samples based on the approach where and are generated via splitting using .
- User
also i should mention i want the model to predict 3 values for each data row, 2 of them are coninues values that can be between -100 to +100 and one of them is a label which can be 0 or 1
their corresponding values in csv files are following columns : y_High_1d y_Low_1d
y_Priority_1d (0 or 1)
- Assistant
- User
is it more efficent if i train different model for each output?
- Assistant
- User
i explain the tasks and you help me decide : im training a model to predict crypto currencies change in next day , model should predict next day high price(y_High_1d), low price(y_Low_1d), and if high will happen before low or not(y_Priority_1d)
so what do you think?should i train a Multi-Output Model or Separate Models?
- Assistant
- User
i also want to have multiple hidden layers
- Assistant
- User
so what happens to 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('target', axis=1).values y = data['target'].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): X_batch = X[i:i+batch_size] y_batch = y[i:i+batch_size] yield X_batch, y_batch - Assistant