Menu

Calculating Model Accuracy

Calculating Model Accuracy

Accuracy measures the percentage of reviews that the model classified correctly.

It is one of the most commonly used evaluation metrics for classification models.

Accuracy Formula

Accuracy = (Correct Predictions / Total Predictions) × 100

Code

from sklearn.metrics import accuracy_score
accuracy = accuracy_score(y_test, y_pred)
print(f"Accuracy: {accuracy:.2f}")

Display Accuracy as a Percentage

print(f"Model Accuracy: {accuracy * 100:.2f}%")

Explanation

A higher accuracy indicates that the model correctly identifies fake and genuine reviews more often.

For many fake review datasets, Logistic Regression with TF-IDF can achieve an accuracy of 90% or higher, depending on the quality and balance of the data.