FraudSentinelX / Model Performance.py
yekkala's picture
Create Model Performance.py
698e88e verified
raw
history blame contribute delete
494 Bytes
import matplotlib.pyplot as plt
class FraudDetection:
def plot_model_performance(self):
# Example: Plot confusion matrix
plt.figure(figsize=(5, 4))
plt.imshow([[0.9, 0.1], [0.2, 0.8]])
plt.colorbar()
plt.xlabel("Predicted")
plt.ylabel("Actual")
plt.title("Confusion Matrix")
buf = io.BytesIO()
plt.savefig(buf, format='png')
plt.close()
buf.seek(0)
image = Image.open(buf)
return image