From 277a2e617ff3418813b30657aa418809139c973b Mon Sep 17 00:00:00 2001 From: Alejandro Moreo Date: Tue, 18 Nov 2025 10:12:41 +0100 Subject: [PATCH] added aggregative bootstrap --- BayesianKDEy/full_experiments.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/BayesianKDEy/full_experiments.py b/BayesianKDEy/full_experiments.py index 6ec372d..c60b37c 100644 --- a/BayesianKDEy/full_experiments.py +++ b/BayesianKDEy/full_experiments.py @@ -9,7 +9,7 @@ from sklearn.model_selection import GridSearchCV, StratifiedKFold from copy import deepcopy as cp import quapy as qp from BayesianKDEy._bayeisan_kdey import BayesianKDEy -from method.aggregative import DistributionMatchingY as DMy +from quapy.method.aggregative import DistributionMatchingY as DMy from quapy.method.base import BinaryQuantifier from quapy.model_selection import GridSearchQ from quapy.data import Dataset @@ -50,12 +50,13 @@ def methods(): acc_hyper = {} hdy_hyper = {'n_bins': [3,4,5,8,16,32]} kdey_hyper = {'bandwidth': [0.001, 0.005, 0.01, 0.05, 0.1, 0.2]} - yield 'BootstrapACC', AggregativeBootstrap(ACC(LR()), n_test_samples=1000, random_state=0), acc_hyper - # yield 'BootstrapHDy', AggregativeBootstrap(DMy(LR(), divergence='HD'), n_test_samples=1000, random_state=0), hdy_hyper - # yield 'BootstrapKDEy', AggregativeBootstrap(KDEyML(LR()), n_test_samples=1000, random_state=0), kdey_hyper + wrap_hyper = lambda dic: {f'quantifier__{k}':v for k,v in dic.items()} + # yield 'BootstrapACC', AggregativeBootstrap(ACC(LR()), n_test_samples=1000, random_state=0), wrap_hyper(acc_hyper) + yield 'BootstrapHDy', AggregativeBootstrap(DMy(LR(), divergence='HD'), n_test_samples=1000, random_state=0), wrap_hyper(hdy_hyper) + #yield 'BootstrapKDEy', AggregativeBootstrap(KDEyML(LR()), n_test_samples=1000, random_state=0), wrap_hyper(kdey_hyper) # yield 'BayesianACC', BayesianCC(LR(), mcmc_seed=0), acc_hyper # yield 'BayesianHDy', PQ(LR(), stan_seed=0), hdy_hyper - yield 'BayesianKDEy', BayesianKDEy(LR(), mcmc_seed=0), kdey_hyper + # yield 'BayesianKDEy', BayesianKDEy(LR(), mcmc_seed=0), kdey_hyper def experiment(dataset: Dataset, method: WithConfidenceABC, grid: dict): @@ -99,7 +100,7 @@ def experiment(dataset: Dataset, method: WithConfidenceABC, grid: dict): results['coverage'].append(region.coverage(true_prevalence)) results['amplitude'].append(region.montecarlo_proportion(n_trials=50_000)) results['test-time'].append(ttime) - results['samples'].append(optim_quantifier.) + results['samples'].append(region.samples) report = { 'optim_hyper': best_params,