QuaPy/quapy/tests/test_hierarchy.py

32 lines
875 B
Python
Raw Normal View History

2022-05-25 19:14:33 +02:00
import unittest
from sklearn.linear_model import LogisticRegression
import quapy as qp
from quapy.method.aggregative import *
class HierarchyTestCase(unittest.TestCase):
def test_aggregative(self):
lr = LogisticRegression()
for m in [CC(lr), PCC(lr), ACC(lr), PACC(lr)]:
self.assertEqual(isinstance(m, AggregativeQuantifier), True)
def test_binary(self):
lr = LogisticRegression()
for m in [HDy(lr)]:
self.assertEqual(isinstance(m, BinaryQuantifier), True)
def test_probabilistic(self):
lr = LogisticRegression()
for m in [CC(lr), ACC(lr)]:
2023-11-15 10:55:13 +01:00
self.assertEqual(isinstance(m, AggregativeSoftQuantifier), False)
2022-05-25 19:14:33 +02:00
for m in [PCC(lr), PACC(lr)]:
2023-11-15 10:55:13 +01:00
self.assertEqual(isinstance(m, AggregativeSoftQuantifier), True)
2022-05-25 19:14:33 +02:00
if __name__ == '__main__':
unittest.main()