Exercise help__

How would I go about completing this exercise? Lesson 2 has been a bit difficult and feeling stuck on this one. Can someone revise it please?

EXERCISE : Initialize the LogisticRegression model with different arguments and try to achieve a higher accuracy. The arguments used for initializing the model are called hyperparameters (to differentiate them from weights and biases - parameters that are learned by the model during training). You can find the full list of arguments here: sklearn.linear_model.LogisticRegression — scikit-learn 0.24.2 documentation

My attempt:

from sklearn.linear_model import LogisticRegression

model2 = LogisticRegression(
tol=0.01,
class_weight=‘balanced’,
solver=‘liblinear’)

model2.fit(train_inputs[numeric_cols + encoded_cols], train_targets)
print(model2.intercept_)

X_train2 = train_inputs[numeric_cols + encoded_cols]
X_val2 = val_inputs[numeric_cols + encoded_cols]
X_test2 = test_inputs[numeric_cols + encoded_cols]

train_preds2 = model.predict(X_train2)

train_probs2 = model.predict_proba(X_train2)


from sklearn.metrics import accuracy_score
accuracy_score(train_targets, train_preds2)

from sklearn.metrics import confusion_matrix

confusion_matrix(train_targets, train_preds2, normalize=‘true’)


train_preds = predict_and_plot(X_train2, train_targets, ‘Training’)

What are you facing confusion with? The code seems correct to me. What is the error you are getting?

In the next part where I train a logistic regression model using just the numeric columns from the dataset it gives me a error

Hey, you are getting this error because you are doing model.fit() instead of model3.fit(). model3.fit() was the model used to train with numeric cols only.