Update app.py
Browse files
app.py
CHANGED
|
@@ -74,7 +74,7 @@ except ValueError as e:
|
|
| 74 |
# Logistic Regression Model
|
| 75 |
# max iter exceeding 200 doesnt improve anything
|
| 76 |
# Don't set C low, set to 100+ default. 200 works better.
|
| 77 |
-
model = LogisticRegression(C=
|
| 78 |
model.fit(X_train_resampled, y_train_resampled)
|
| 79 |
|
| 80 |
# Evaluate Model
|
|
@@ -84,10 +84,10 @@ precision = precision_score(y_test, y_pred, average='weighted')
|
|
| 84 |
recall = recall_score(y_test, y_pred, average='weighted')
|
| 85 |
f1 = f1_score(y_test, y_pred, average='weighted')
|
| 86 |
|
| 87 |
-
print(f"
|
| 88 |
-
print(f"Precision: {precision:.
|
| 89 |
-
print(f"Recall:
|
| 90 |
-
print(f"F1 Score:
|
| 91 |
|
| 92 |
def predict_tone(text):
|
| 93 |
# Vectorize
|
|
|
|
| 74 |
# Logistic Regression Model
|
| 75 |
# max iter exceeding 200 doesnt improve anything
|
| 76 |
# Don't set C low, set to 100+ default. 200 works better.
|
| 77 |
+
model = LogisticRegression(C=200, max_iter=200, n_jobs=-1, solver='lbfgs', multi_class='multinomial')
|
| 78 |
model.fit(X_train_resampled, y_train_resampled)
|
| 79 |
|
| 80 |
# Evaluate Model
|
|
|
|
| 84 |
recall = recall_score(y_test, y_pred, average='weighted')
|
| 85 |
f1 = f1_score(y_test, y_pred, average='weighted')
|
| 86 |
|
| 87 |
+
print(f"Accuracy: {(1 - accuracy) * 100:.2f}%")
|
| 88 |
+
print(f"Precision: {(1 - precision) * 100:.2f}%")
|
| 89 |
+
print(f"Recall: {(1 - recall) * 100:.2f}%")
|
| 90 |
+
print(f"F1 Score: {(1 - f1) * 100:.2f}%")
|
| 91 |
|
| 92 |
def predict_tone(text):
|
| 93 |
# Vectorize
|