2023-11-08 11:07:47 +01:00
|
|
|
import quapy as qp
|
|
|
|
from sklearn.linear_model import LogisticRegression
|
|
|
|
from quapy.evaluation import evaluation_report
|
|
|
|
|
|
|
|
|
|
|
|
def newLR():
|
|
|
|
return LogisticRegression(n_jobs=-1)
|
|
|
|
|
2024-02-07 18:45:42 +01:00
|
|
|
<<<<<<< HEAD
|
2023-11-08 11:31:33 +01:00
|
|
|
|
|
|
|
quantifiers = [
|
|
|
|
('CC', qp.method.aggregative.CC(newLR())),
|
|
|
|
('ACC', qp.method.aggregative.ACC(newLR())),
|
|
|
|
('PCC', qp.method.aggregative.PCC(newLR())),
|
|
|
|
('PACC', qp.method.aggregative.PACC(newLR())),
|
2023-11-09 18:13:54 +01:00
|
|
|
('HDy', qp.method.aggregative.DMy(newLR())),
|
2023-11-08 11:31:33 +01:00
|
|
|
('EMQ', qp.method.aggregative.EMQ(newLR()))
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
for quant_name, quantifier in quantifiers:
|
2024-02-07 18:45:42 +01:00
|
|
|
=======
|
|
|
|
quantifiers = {'CC':qp.method.aggregative.CC(newLR()),
|
|
|
|
'ACC':qp.method.aggregative.ACC(newLR()),
|
|
|
|
'PCC':qp.method.aggregative.PCC(newLR()),
|
|
|
|
'PACC':qp.method.aggregative.PACC(newLR()),
|
|
|
|
'HDy':qp.method.aggregative.DistributionMatching(newLR()),
|
|
|
|
'EMQ':qp.method.aggregative.EMQ(newLR())
|
|
|
|
}
|
|
|
|
|
|
|
|
for quant_name, quantifier in quantifiers.items():
|
|
|
|
>>>>>>> 5566e0c97ae1b49b30874b6610d7f5b062009271
|
2023-11-08 11:07:47 +01:00
|
|
|
print("Experiment with "+quant_name)
|
|
|
|
|
|
|
|
train, test_gen = qp.datasets.fetch_IFCB()
|
|
|
|
|
|
|
|
quantifier.fit(train)
|
|
|
|
|
|
|
|
report = evaluation_report(quantifier, protocol=test_gen, error_metrics=['mae'], verbose=True)
|
|
|
|
print(report.mean())
|