File size: 832 Bytes
b144cb7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import pandas as pd
import joblib
from sklearn.metrics import accuracy_score, classification_report, confusion_matrix


test_df = pd.read_csv("basemodel/test_features.csv")


drop_cols = ["Label"]
if "language" in test_df.columns:
    drop_cols.append("language")

X_test = test_df.drop(columns=drop_cols)
y_test = test_df["Label"]


rf = joblib.load("basemodel/random_forest_baseline.pkl")


test_preds = rf.predict(X_test)

accuracy = accuracy_score(y_test, test_preds)


print("\n🧪 TEST SET EVALUATION (Statistical Baseline)\n")
print("Test Accuracy:", round(accuracy, 4))

print("\nClassification Report:\n")
print(
    classification_report(
        y_test,
        test_preds,
        target_names=["Human", "AI"],
        zero_division=0
    )
)

print("\nConfusion Matrix:\n")
print(confusion_matrix(y_test, test_preds))