import pandas as pd import numpy as np from sklearn.model_selection import train_test_split # Set random seed for reproducibility np.random.seed(42) # Load the combined dataset df = pd.read_parquet('affinity-data-combined.parquet') # First split off test set (5%) train_val_df, test_df = train_test_split(df, test_size=0.05, random_state=42) # Split remaining data into train and validation (90% and 5% of total) train_df, val_df = train_test_split(train_val_df, test_size=0.05263158, random_state=42) # 0.0526 of 95% is 5% of total # Save the splits to parquet files train_df.to_parquet('train.parquet', index=False) val_df.to_parquet('val.parquet', index=False) test_df.to_parquet('test.parquet', index=False)