# What should be the target variable shape? should it be (n,1) or (n,)?

I tried logistic regression on the titanic dataset but used 2 different code: 1st code:

d = pd.read_csv("titanic.csv) # did all the data preparation
x = d.values[:,1:]
y = d.values[:,1]
m.fit(x_train,y_train)


and fit the data in and got an accuracy of 97.3%. but in 2nd code i used

x = d.values[:,1:]
y = d.values[:,:1]
m.fit(x_train, y_train.ravel())


and fit the data in the model and got an accuracy of 75.7%.
The only difference is, in the first code y shape was (183,) and in the second code, y shape was (183,1). so which one is correct? what should be the shape of the target variable? find full the first code and second code here.

• show a few values of your y data for both cases please Jan 13 at 14:13