1
$\begingroup$

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.

$\endgroup$
1
  • 1
    $\begingroup$ show a few values of your y data for both cases please $\endgroup$
    – Peter
    Jan 13 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.