text_plain_output_1.png
from pyradox_tabular.data import DataLoader

from sklearn.preprocessing import LabelEncoder

from sklearn.preprocessing import OneHotEncoder

from sklearn.preprocessing import RobustScaler

from sklearn.utils import shuffle

import pandas as pd

test = pd.read_csv('../input/tabular-playground-series-feb-2022/test.csv')
train = pd.read_csv('../input/tabular-playground-series-feb-2022/train.csv')

from sklearn.utils import shuffle
train = shuffle(train)

features = [c for c in train.columns if c not in ('target', 'row_id')]
target = 'target'
x_test = test[features]
y = train[target]
X = train[features]
numerical_features = X.columns

from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()
y = le.fit_transform(y)

from sklearn.preprocessing import OneHotEncoder
oe = OneHotEncoder()

target = oe.fit_transform(y.reshape(-1, 1))
target = target.toarray()
targetyDF = pd.DataFrame(target)
yDF = targetyDF

X_train = X[:87500]
y_train = yDF[:87500]
X_valid = X[87500:]
y_valid = yDF[87500:]

X_train.shape[0] + X_valid.shape[0] == X.shape[0]

from sklearn.preprocessing import RobustScaler
RobustScaler_transformer = RobustScaler().fit(X_train.values)

X_trainRobustScaler = RobustScaler_transformer.transform(X_train.values)
X_validRobustScaler = RobustScaler_transformer.transform(X_valid.values)
X_testRobustScaler = RobustScaler_transformer.transform(x_test.values)

X_train = pd.DataFrame(X_trainRobustScaler, columns=list(numerical_features))

X_valid = pd.DataFrame(X_validRobustScaler, columns=list(numerical_features))

x_test = pd.DataFrame(X_testRobustScaler, columns=list(numerical_features))

data_train = DataLoader.from_df(X_train, y_train, batch_size=64 * 2)
data_valid = DataLoader.from_df(X_valid, y_valid, batch_size=64 * 2)
data_test = DataLoader.from_df(x_test, batch_size=64 * 2)