# Split the data into train and test sets train_size = int(len(df)*0.7) train, test = df.iloc[:train_size],df.iloc[train_size:] # Split train and test sets into predictors (X) and outcome (y) variables X_train = train.drop('Activity', axis = 1) y_train = train.loc[:,['Activity']] X_test = test.drop('Activity', axis = 1) y_test = test.loc[:,['Activity']] # Scale the X data scaler_x = MinMaxScaler(feature_range = (0,1)) input_scaler = scaler_x.fit(X_train) train_x_norm = input_scaler.transform(X_train) test_x_norm = input_scaler.transform(X_test) # One-hot encode y data y_train = to_categorical(y_train) y_test = to_categorical(y_test)