IUM_06
This commit is contained in:
parent
a8cf8d2829
commit
9d6ffe8205
17
metrics.py
17
metrics.py
@ -1,8 +1,4 @@
|
||||
from sklearn.metrics import (
|
||||
accuracy_score,
|
||||
precision_score,
|
||||
recall_score,
|
||||
)
|
||||
from sklearn.metrics import confusion_matrix
|
||||
import pandas as pd
|
||||
|
||||
|
||||
@ -10,14 +6,15 @@ def main():
|
||||
y_test = pd.read_csv("data/y_test.csv")
|
||||
y_pred = pd.read_csv("evaluation/y_pred.csv", header=None)
|
||||
|
||||
accuracy = accuracy_score(y_test, y_pred)
|
||||
precision_micro = precision_score(y_test, y_pred, average="micro")
|
||||
recall_micro = recall_score(y_test, y_pred, average="micro")
|
||||
cm = confusion_matrix(y_test, y_pred)
|
||||
print(
|
||||
"Recall metric in the testing dataset: ",
|
||||
cm[1, 1] / (cm[1, 0] + cm[1, 1]),
|
||||
)
|
||||
accuracy = cm[1, 1] / (cm[1, 0] + cm[1, 1])
|
||||
|
||||
with open(r"evaluation/metrics.txt", "a") as f:
|
||||
f.write(f"Accuracy: {accuracy}\n")
|
||||
f.write(f"Micro-average Precision: {precision_micro}\n")
|
||||
f.write(f"Micro-average Recall: {recall_micro}\n")
|
||||
f.write(f"\n")
|
||||
|
||||
|
||||
|
@ -11,6 +11,7 @@ import numpy as np
|
||||
def main():
|
||||
model = load_model("model/model.keras")
|
||||
X_test = pd.read_csv("data/X_test.csv")
|
||||
y_test = pd.read_csv("data/y_test.csv")
|
||||
|
||||
y_pred = model.predict(X_test)
|
||||
y_pred = y_pred >= 0.5
|
||||
|
Loading…
Reference in New Issue
Block a user