Feature Scaling Issue

Viewed 14

I'm running into an issue where I try to scale my data, but my outputs are either 0 or 1, I'm wondering if the data frame is the problem or my code is just bad

(I just started learning machine learning and coding on my own, so I apologize if this is a very stupid mistake)

code:

def binarymap(x):
return x.map({'yes':1, 'no':0})

cat_data = ['mainroad', 'guestroom', 'basement', 'hotwaterheating', 'airconditioning', 
'prefarea']
x[cat_data] = x[cat_data].apply(binarymap)

mcat_data = ['furnishingstatus']
x = pd.get_dummies(x, columns=(mcat_data))

x = x.to_numpy()

from sklearn.model_selection import train_test_split
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size = .25, random_state 
= 0)

from sklearn.preprocessing import MinMaxScaler
sc = MinMaxScaler()
x_train[:, :5] = sc.fit_transform(x_train[:, :5])
x_test[:, :5]= sc.transform(x_test[:, :5])
0 Answers
Related