# How to improve results from ML model? (spam classification)

I am trying to build a model that predicts if an email is spam/not-spam. After building a logistic regression model, I have got the following results:

          precision    recall  f1-score   support

0.0       0.92      0.99      0.95       585
1.0       0.76      0.35      0.48        74

accuracy                           0.92       659
macro avg       0.84      0.67      0.72       659
weighted avg       0.91      0.92      0.90       659

Confusion Matrix:
[[577   8]
[ 48  26]]

Accuracy:  0.9150227617602428


The F1-score is the metric I am looking at. I am having difficulties in explaining the results: I think are very bad results! May I ask you how I could improve it? I am currently considering a model that looks at corpus of the emails (subject + corpus).

I oversampled the dataset and these are my results:

Logistic regression
precision    recall  f1-score   support

0.0       0.94      0.77      0.85       573
1.0       0.81      0.96      0.88       598

accuracy                           0.86      1171
macro avg       0.88      0.86      0.86      1171
weighted avg       0.88      0.86      0.86      1171

Random Forest
precision    recall  f1-score   support

0.0       0.97      0.54      0.69       573
1.0       0.69      0.98      0.81       598

accuracy                           0.77      1171
macro avg       0.83      0.76      0.75      1171
weighted avg       0.83      0.77      0.75      1171


• thanks, Erwan. So what I did was: smote_over_sample = SMOTE(sampling_strategy='minority') # Testing Count Vectorizer X, y = bag_of_words(df) X, y = smote_over_sample.fit_resample(X, y) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=40) smote_result = smote_result.append(training_log(X_train, X_test, y_train, y_test, 'Count Vectorize'), ignore_index = True) Is it wrong? I have followed this example: kaggle.com/ruzarx/oversampling-smote-and-adasyn – LdM Dec 7 '20 at 1:02