Skip to content

Commit 3d8a1c1

Browse files
committed
merge from devel
2 parents c7b4712 + eeaa677 commit 3d8a1c1

10 files changed

Lines changed: 575 additions & 15 deletions

File tree

‎CHANGE_LOG.txt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Change Log 0.2.2
2+
-----------------
3+
4+
- Added HistNetQ, based on the original implementation https://github.com/pglez84/histnetq
5+
6+
- Minor fixes
7+
18
Change Log 0.2.1
29
-----------------
310

‎TODO.txt‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
Solve the warnings issue; right now there is a warning ignore in method/__init__.py:
2-
31
Add 'platt' to calib options in EMQ?
42

53
Allow n_prevpoints in APP to be specified by a user-defined grid?
64

7-
Add the fix suggested by Alexander?
8-
"For a more general application, I would maybe first establish a per-class threshold value of plausible prevalence
5+
Add the fix suggested by Alexander:
6+
7+
For a more general application, I would maybe first establish a per-class threshold value of plausible prevalence
98
based on the number of actual positives and the required sample size; e.g., for sample_size=100 and actual
109
positives [10, 100, 500] -> [0.1, 1.0, 1.0], meaning that class 0 can be sampled at most at 0.1 prevalence, while
1110
the others can be sampled up to 1. prevalence. Then, when a prevalence value is requested, e.g., [0.33, 0.33, 0.33],
1211
we may either clip each value and normalize (as you suggest for the extreme case, e.g., [0.1, 0.33, 0.33]/sum) or
13-
scale each value by per-class thresholds, i.e., [0.33*0.1, 0.33*1, 0.33*1]/sum."
12+
scale each value by per-class thresholds, i.e., [0.33*0.1, 0.33*1, 0.33*1]/sum.
1413
- This affects LabelledCollection
1514
- This functionality should be accessible via sampling protocols and evaluation functions
1615

17-
- [TODO] document confidence in manuals
16+
- [TODO] Test the return_type="index" in protocols and finish the "distributing_samples.py" example
1817
- [TODO] add ensemble methods SC-MQ, MC-SQ, MC-MQ
19-
- [TODO] add HistNetQ
2018
- [TODO] add CDE-iteration and Bayes-CDE methods
2119
- [TODO] add Friedman's method and DeBias
2220
- [TODO] check ignore warning stuff

‎docs/source/manuals/methods.md‎

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,36 @@ model.fit(*dataset.training.Xy)
851851
estim_prevalence = model.predict(dataset.test.X)
852852
```
853853

854-
(confidence-regions-for-class-prevalence-estimation)=
854+
### HistNetQ
855+
856+
QuaPy offers an implementation of HistNetQ, a deep learning model based on a differentiable
857+
histogram representation, presented in:
858+
859+
[_Pérez-Mon, O., Moreo, A., del Coz, J.J., & González, P. (2025).
860+
Quantification using permutation-invariant networks based on histograms.
861+
Neural Computing and Applications, 37(5), 3505-3520._](https://doi.org/10.1007/s00521-024-10721-1)
862+
863+
This model requires `torch` to be installed. Like QuaNet, HistNetQ is trained end-to-end on
864+
samples ("bags") of known prevalence rather than on individually labeled instances; unlike QuaNet,
865+
it requires no classifier at all, only an optional feature extraction module (a plain identity
866+
module is used by default, for already-vectorized data).
867+
868+
```python
869+
import quapy as qp
870+
from quapy.method.meta import HistNetQ
871+
872+
dataset = qp.datasets.fetch_UCIBinaryDataset('haberman')
873+
874+
model = HistNetQ(bag_size=100, device='cpu')
875+
model.fit(*dataset.training.Xy)
876+
estim_prevalence = model.predict(dataset.test.X)
877+
```
878+
879+
HistNetQ can alternatively be trained directly from a protocol that already provides the training
880+
samples (e.g., when only bag-level prevalence values are available), via the `fit_from_samples`
881+
method; see the API documentation for further details.
882+
883+
855884
## Quantifiers with Uncertainty Quantification
856885

857886
_(New in v0.2.0!)_ Some quantification methods go beyond providing a single point estimate of class prevalence values and also produce confidence regions, which characterize the uncertainty around the point estimate. In QuaPy, two such families are currently implemented: bootstrap methods and Bayesian methods.

‎docs/source/quapy.method.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ quapy.method.aggregative module
1717
:undoc-members:
1818
:show-inheritance:
1919

20-
.. automodule:: quapy.method._neural
20+
.. automodule:: quapy.method._quanet
2121
:members:
2222
:undoc-members:
2323
:show-inheritance:

‎quapy/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
except ImportError:
1818
plot = None
1919

20-
__version__ = '0.2.1.post1'
20+
__version__ = '0.2.2'
2121

2222

2323
def _default_cls():

‎quapy/method/__init__.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@
7474

7575
META_METHODS = {
7676
meta.Ensemble,
77-
meta.QuaNet
77+
meta.QuaNet,
78+
meta.HistNetQ
7879
}
7980

8081
QUANTIFICATION_METHODS = AGGREGATIVE_METHODS | NON_AGGREGATIVE_METHODS | META_METHODS

0 commit comments

Comments
 (0)