Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementations for KDEy Methods #8

Open
wants to merge 29 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
213eb18
First working implementation of KDEyHD and KDEyCS
tobiaslotz Feb 1, 2024
19e9bf0
working version for all 3 KDEy variants
tobiaslotz Feb 1, 2024
6133d69
moved inverse count calculation into fit step of KDEyCS and added KDE…
tobiaslotz Feb 5, 2024
90c7b82
implemented first class independant version of KDE and added KDE to l…
tobiaslotz Feb 8, 2024
209fb8d
removed KDEyHD from lequa experiment due to high memory demand of cur…
tobiaslotz Feb 12, 2024
31b0e42
added small epsilon in loss functions
tobiaslotz Mar 1, 2024
1409506
Merge branch 'mirkobunse:main' into main
tobiaslotz Mar 1, 2024
0aad30c
included KDEy-Methods in lequa experiment
tobiaslotz Mar 1, 2024
13ee13a
Merge remote-tracking branch 'origin/main'
tobiaslotz Mar 1, 2024
d77c495
added Quapy implementation of KDEy-Methods to LeQua experiments
tobiaslotz Mar 4, 2024
961b3b3
corrected param grid mistake
tobiaslotz Mar 4, 2024
416111c
corrected param grid mistake
tobiaslotz Mar 4, 2024
0dbadce
updated KDEyML-Loss to fix NaN issues and updated experiment
tobiaslotz Mar 6, 2024
b3ff892
added SLD to lequa experiment
tobiaslotz Mar 7, 2024
14055ad
updated SLD parameter grid
tobiaslotz Mar 7, 2024
48bcb7f
Use raise_errors = True instead of MyGridSearch and reshape q conform…
mirkobunse Mar 7, 2024
386e0c1
Refactor qunfold.methods.GenericMethod -> qunfold.methods.linear.Line…
mirkobunse Mar 11, 2024
71dcae6
KDEyML is not a LinearMethod anymore
mirkobunse Mar 11, 2024
bbd6058
added the ability to tune different bandwidths for every class in KDE…
tobiaslotz Mar 21, 2024
386ab1f
added classwise scott and silverman bandwidth estimation and added th…
tobiaslotz Mar 25, 2024
2174c57
changed scott calculation
tobiaslotz Mar 25, 2024
11ad31d
updated silverman
tobiaslotz Mar 25, 2024
3f571e8
Implementation of KDEyML like in quapy but with potentially more band…
tobiaslotz Mar 27, 2024
9c7f761
added QuaPy-Model to experiment to validate implementation
tobiaslotz Apr 3, 2024
a1b646b
removed qunfold KDEyML version from lequa experiment to avoid memory …
tobiaslotz Apr 15, 2024
2bcd2f3
fixed param grid for QuaPy
tobiaslotz Apr 15, 2024
8703ed7
changed scott and silverman method to use sklearns variant
tobiaslotz Apr 16, 2024
b5af1dd
changed KDEyML version to match cross_validation method of QuaPy
tobiaslotz Apr 19, 2024
a002892
fixed error in param grid
tobiaslotz Apr 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions docs/source/api.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# API

The `GenericMethod` defines the interface for many common quantification and unfolding algorithms. Most importantly, this interface consists of their `fit` and `predict` methods.
The `AbstractMethod` defines the interface for all quantification and unfolding algorithms. Most importantly, this interface consists of their `fit` and `predict` methods.

Instances of [](#popular-algorithms) for quantification and unfolding are created through the corresponding constructors. However, you can also define your own quantification methods as a `GenericMethod` that combines an arbitrary choice of [](#losses), [](#regularizers) and [](#feature-transformations).
```{eval-rst}
.. autoclass:: qunfold.AbstractMethod
:members:
```

Instances of [](#popular-algorithms) for quantification and unfolding are created through the corresponding constructors. However, you can also define your own quantification methods as a `LinearMethod` that combines an arbitrary choice of [](#losses), [](#regularizers) and [](#feature-transformations).

```{eval-rst}
.. autoclass:: qunfold.GenericMethod
.. autoclass:: qunfold.LinearMethod
:members:
```

Expand Down
4 changes: 2 additions & 2 deletions docs/source/developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ As soon as you push to the `main` branch, GitHub Actions will build the document

## Custom implementations

Custom [](#losses) and [](#feature-transformations) can be used in any instance of `GenericMethod`. Use the already existing implementations as examples.
Custom [](#losses) and [](#feature-transformations) can be used in any instance of `LinearMethod`. Use the already existing implementations as examples.


### Losses

The most convenient way of implementing a custom loss is to create a [JAX](https://jax.readthedocs.io/)-powered function `(p, q, M, N) -> loss_value`. From this function, you can create a *FunctionLoss* object to be used in any instance of `GenericMethod`.
The most convenient way of implementing a custom loss is to create a [JAX](https://jax.readthedocs.io/)-powered function `(p, q, M, N) -> loss_value`. From this function, you can create a *FunctionLoss* object to be used in any instance of `LinearMethod`.

```{eval-rst}
.. autoclass:: qunfold.losses.FunctionLoss
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ loss = TikhonovRegularized(LeastSquaresLoss(), 0.01)
transformer = ClassTransformer(CVClassifier(LogisticRegression(), 10))

# the ordinal variant of ACC, ready for being used in QuaPy
ordinal_acc = QuaPyWrapper(GenericMethod(loss, transformer))
ordinal_acc = QuaPyWrapper(LinearMethod(loss, transformer))
```
19 changes: 17 additions & 2 deletions qunfold/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
CombinedLoss,
TikhonovRegularization,
TikhonovRegularized,
KDEyHDLoss,
KDEyCSLoss,
KDEyMLLoss,
)

from .transformers import (
Expand All @@ -18,10 +21,14 @@
LaplacianKernelTransformer,
GaussianKernelTransformer,
GaussianRFFKernelTransformer,
KDEyHDTransformer,
KDEyCSTransformer,
KDEyMLTransformerID,
)

from .methods import (
GenericMethod,
from .methods.linear import (
AbstractMethod,
LinearMethod,
ACC,
PACC,
RUN,
Expand All @@ -30,4 +37,12 @@
EDx,
EDy,
KMM,
KDEyHD,
KDEyCS,
KDEyMLID,
)

from .methods.kernel_density import (
KDEyML,
KDEyMLQP,
)
Loading
Loading