-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
from pycaret.datasets import get_data
data = get_data('juice')
from pycaret.classification import *
s = setup(data, target = 'Purchase', session_id = 123, silent = True)
# create a custom function
def calculate_specificity(y, y_pred):
tp, tn, fn, fp = 0.0,0.0,0.0,0.0
for l,m in enumerate(y):
if m==y_pred[l] and m==1:
tp+=1
if m==y_pred[l] and m==0:
tn+=1
if m!=y_pred[l] and m==1:
fn+=1
if m!=y_pred[l] and m==0:
fp+=1
return tn/(tn+fp)
# add metric to PyCaret
add_metric('specificity', 'specificity', calculate_specificity)
lr = create_model('lr')
Originally posted by @moezali1 in #1593 (comment)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working