<jupyter_start><jupyter_text>Example-3 (Activation threshold)<jupyter_code>from pycm import ConfusionMatrix

def activation_1(i):
    if i<0.75:
        return 1
    else:
        return 0
y_actual = [1,1,0,1,1,0]
y_pred = [0.65,0.34,0.80,0.54,0.32,0.12]
cm = ConfusionMatrix(y_actual,y_pred,threshold=activation_1)
cm.classes
print(cm)<jupyter_output>Predict 0       1       
Actual
0       1       1       

1       0       4       





Overall Statistics : 

95% CI                                                            (0.53513,1.13154)
AUNP                                                              0.75
AUNU                                                              0.75
Bennett S                                                         0.66667
CBA                                                               0.65
Chi-Squared                                                       2.4
Chi-Squared DF                                                    1
Conditional Entropy                                               0.33333
Cramer V                                                          0.63246
Cross Entropy                                                     1.03701
Gwet AC1                                                          0.73333
Hamming Loss                                                      0.16667
Joint Entr[...]
{'fraction_non_alphanumeric': 0.05379513633014001, 'fraction_numerical': 0.0759027266028003, 'mean_word_length': 0.5957696827262045, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '35479', 'license': 'MIT', 'n_tokens_mistral': 358, 'n_tokens_neox': 290, 'n_words': 68, 'path': 'Document/Example3.ipynb', 'repo_name': 'cnheider/pycm', 'size': '1357'}