Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def TI(self, alpha, beta):
"""
Calculate Tversky index.
:param alpha: alpha coefficient
:type alpha : float
:param beta: beta coefficient
:type beta: float
:return: TI as float
"""
try:
TI_dict = {}
for i in self.classes:
TI_dict[i] = TI_calc(
self.TP[i], self.FP[i], self.FN[i], alpha, beta)
return TI_dict
except Exception:
return {}