2021-01-15 18:32:32 +01:00
|
|
|
from quapy.data import LabelledCollection
|
2020-12-03 18:12:28 +01:00
|
|
|
from .base import BaseQuantifier
|
|
|
|
|
|
|
|
|
|
|
|
class MaximumLikelihoodPrevalenceEstimation(BaseQuantifier):
|
|
|
|
|
|
|
|
def __init__(self, **kwargs):
|
2021-05-04 17:09:13 +02:00
|
|
|
self._classes_ = None
|
2020-12-03 18:12:28 +01:00
|
|
|
|
|
|
|
def fit(self, data: LabelledCollection, *args):
|
2021-05-04 17:09:13 +02:00
|
|
|
self._classes_ = data.classes_
|
2020-12-03 18:12:28 +01:00
|
|
|
self.estimated_prevalence = data.prevalence()
|
2021-10-21 17:14:40 +02:00
|
|
|
return self
|
2020-12-03 18:12:28 +01:00
|
|
|
|
|
|
|
def quantify(self, documents, *args):
|
|
|
|
return self.estimated_prevalence
|
|
|
|
|
2021-05-04 17:09:13 +02:00
|
|
|
@property
|
|
|
|
def classes_(self):
|
|
|
|
return self._classes_
|
|
|
|
|
2020-12-03 18:12:28 +01:00
|
|
|
def get_params(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def set_params(self, **parameters):
|
|
|
|
pass
|