File size: 494 Bytes
698e88e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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