2023-04-19 15:27:00 +02:00
|
|
|
import pandas
|
|
|
|
import os
|
2023-05-10 19:13:25 +02:00
|
|
|
|
|
|
|
from keras.applications.densenet import layers
|
|
|
|
|
2023-04-19 17:06:00 +02:00
|
|
|
from sklearn.model_selection import train_test_split
|
2023-05-10 19:13:25 +02:00
|
|
|
import tensorflow
|
2023-04-19 15:27:00 +02:00
|
|
|
|
|
|
|
|
2023-04-19 17:02:26 +02:00
|
|
|
CUTOFF = int(os.environ['CUTOFF'])
|
2023-04-19 15:27:00 +02:00
|
|
|
|
|
|
|
# READ DATA
|
2023-04-19 16:38:02 +02:00
|
|
|
video_games = pandas.read_csv('./ium_z434686/Video_Games_Sales_as_at_22_Dec_2016.csv',
|
2023-04-19 15:27:00 +02:00
|
|
|
engine='python',
|
|
|
|
encoding='ISO-8859-1',
|
|
|
|
sep=',')
|
2023-05-10 19:13:25 +02:00
|
|
|
|
2023-04-19 15:27:00 +02:00
|
|
|
# DROP NA FIELDS
|
|
|
|
video_games = video_games.dropna()
|
2023-05-10 19:13:25 +02:00
|
|
|
video_games = video_games.drop(video_games.columns[[0, 1, 3, 4, 13, 14, 15]], axis=1)
|
2023-04-19 15:27:00 +02:00
|
|
|
|
|
|
|
# CUT OFF DATASET TO X LINES
|
|
|
|
video_games = video_games.sample(CUTOFF)
|
|
|
|
|
2023-05-10 19:13:25 +02:00
|
|
|
X = video_games.copy()
|
|
|
|
Y = pandas.DataFrame(video_games.pop('User_Score'))
|
2023-04-19 15:27:00 +02:00
|
|
|
|
|
|
|
# SPLIT BETWEEN DEV, TRAINS, AND TEST
|
2023-04-19 17:06:00 +02:00
|
|
|
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)
|
2023-04-19 15:27:00 +02:00
|
|
|
|
2023-04-19 17:08:19 +02:00
|
|
|
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)
|
2023-05-10 19:13:25 +02:00
|
|
|
Y_test.to_csv('Y_test.csv', index=False)
|
|
|
|
Y_train.to_csv('Y_train.csv', index=False)
|
|
|
|
Y_dev.to_csv('Y_dev.csv', index=False)
|