ium_z444439/create-dataset.py

19 lines
603 B
Python
Raw Normal View History

2023-04-19 18:47:42 +02:00
import pandas
import os
from sklearn.model_selection import train_test_split
CUTOFF = int(os.environ['CUTOFF'])
adults = pandas.read_csv('./ium_z444439/adult.csv', engine='python', encoding='ISO-8859-1', sep=',')
adults = adults.dropna()
adults = adults.sample(CUTOFF)
X, Y = adults, adults
X_train, X_temp, Y_train, Y_temp = train_test_split(X, Y, test_size=0.3, random_state=1)
X_dev, X_test, Y_dev, Y_test = train_test_split(X_temp, Y_temp, test_size=0.3, random_state=1)
X_train.to_csv('X_train.csv', index=False)
X_dev.to_csv('X_dev.csv', index=False)
X_test.to_csv('X_test.csv', index=False)