Skip to content

Commit 9916a1e

Browse files
committed
lint
1 parent daf8417 commit 9916a1e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

logistic-regression.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,31 +86,32 @@ def prepare_data():
8686
return train_test_split(x, y, test_size=0.30, stratify=y, random_state=1)
8787

8888

89-
def main():
89+
def logistic_regression():
9090
"""
9191
- create training and test data sets
9292
- create a Logistic Regression model
9393
- train the model
9494
- generate confusion matrix and f-score for the training set
9595
- generate confusion matrix and f-score for the test set
9696
"""
97+
print("Prepare data")
9798
x_train, x_test, y_train, y_test = prepare_data()
9899

99-
# Fit a logistic regression model
100+
print("train model")
100101
model = LogisticRegression()
101102
model.fit(x_train, y_train)
102103

103104
# Set the optimal threshold (refer to the Jupyter Notebook to see how we arrived at 42)
104105
optimal_threshold = 0.42
105106

106-
# Create a confusion matrix for the training data
107+
print("model training data and measure results")
107108
y_pred_train = model.predict_proba(x_train)
108109
metrics_score(y_train, y_pred_train[:, 1] > optimal_threshold)
109110

110-
# Create a confusion matrix for the test data
111+
print("model test data and measure results")
111112
y_pred_test = model.predict_proba(x_test)
112113
metrics_score(y_test, y_pred_test[:, 1] > optimal_threshold)
113114

114115

115116
if __name__ == "__main__":
116-
main()
117+
logistic_regression()

0 commit comments

Comments
 (0)