bioinf595_formed / scripts /st3_random_split.py
haneulpark's picture
Upload 11 files
d927342 verified
raw
history blame contribute delete
528 Bytes
# Split the dataset into test and train using random split
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
# Read dataset
df = pd.read_csv('formed_xyz_combined.csv')
# Split dataset
train_df, test_df = train_test_split(df, test_size=0.2, random_state=42)
# Save split subsets
train_df.to_csv('formed_xyz_train.csv', index=False)
test_df.to_csv('formed_xyz_test.csv', index=False)
print("Length of the train set is", len(train_df))
print("Length of the test set is", len(test_df))