text_html_output_1.png
from sklearn.linear_model import LogisticRegression

from sklearn.metrics import accuracy_score, confusion_matrix, classification_report

from sklearn.preprocessing import LabelEncoder

from sklearn.preprocessing import MinMaxScaler

from sklearn.preprocessing import OrdinalEncoder

import numpy as np # linear algebra

obj_cols = x_train.select_dtypes(include='object').columns
obj_cols

float_cols = x_train.select_dtypes(include='int64').columns
float_cols

from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()
le.fit(y_train)

y_train_processed = le.transform(y_train)
y_test_processed = le.transform(y_test)

from sklearn.preprocessing import OrdinalEncoder
oe = OrdinalEncoder(categories=[x_train[i].unique() for i in obj_cols])
oe.fit(x_train[obj_cols])
x_train_cat_encoded = oe.transform(x_train[obj_cols])
x_test_cat_encoded = oe.transform(x_test[obj_cols])

from sklearn.preprocessing import MinMaxScaler
scaler = MinMaxScaler()
scaler.fit(x_train[float_cols])
x_train_float_encoded = scaler.transform(x_train[float_cols])
x_test_float_encoded = scaler.transform(x_test[float_cols])

x_train_processed = np.hstack((x_train_cat_encoded, x_train_float_encoded))
x_test_processed = np.hstack((x_test_cat_encoded, x_test_float_encoded))

from sklearn.metrics import accuracy_score, confusion_matrix, classification_report
from sklearn.linear_model import LogisticRegression
lr = LogisticRegression()
lr.fit(x_train_processed, y_train_processed)
y_pred = lr.predict(x_test_processed)

lr.coef_