added aggregative bootstrap
This commit is contained in:
parent
be465712cd
commit
277a2e617f
|
|
@ -9,7 +9,7 @@ from sklearn.model_selection import GridSearchCV, StratifiedKFold
|
||||||
from copy import deepcopy as cp
|
from copy import deepcopy as cp
|
||||||
import quapy as qp
|
import quapy as qp
|
||||||
from BayesianKDEy._bayeisan_kdey import BayesianKDEy
|
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.method.base import BinaryQuantifier
|
||||||
from quapy.model_selection import GridSearchQ
|
from quapy.model_selection import GridSearchQ
|
||||||
from quapy.data import Dataset
|
from quapy.data import Dataset
|
||||||
|
|
@ -50,12 +50,13 @@ def methods():
|
||||||
acc_hyper = {}
|
acc_hyper = {}
|
||||||
hdy_hyper = {'n_bins': [3,4,5,8,16,32]}
|
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]}
|
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
|
wrap_hyper = lambda dic: {f'quantifier__{k}':v for k,v in dic.items()}
|
||||||
# yield 'BootstrapHDy', AggregativeBootstrap(DMy(LR(), divergence='HD'), n_test_samples=1000, random_state=0), hdy_hyper
|
# yield 'BootstrapACC', AggregativeBootstrap(ACC(LR()), n_test_samples=1000, random_state=0), wrap_hyper(acc_hyper)
|
||||||
# yield 'BootstrapKDEy', AggregativeBootstrap(KDEyML(LR()), n_test_samples=1000, random_state=0), kdey_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 'BayesianACC', BayesianCC(LR(), mcmc_seed=0), acc_hyper
|
||||||
# yield 'BayesianHDy', PQ(LR(), stan_seed=0), hdy_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):
|
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['coverage'].append(region.coverage(true_prevalence))
|
||||||
results['amplitude'].append(region.montecarlo_proportion(n_trials=50_000))
|
results['amplitude'].append(region.montecarlo_proportion(n_trials=50_000))
|
||||||
results['test-time'].append(ttime)
|
results['test-time'].append(ttime)
|
||||||
results['samples'].append(optim_quantifier.)
|
results['samples'].append(region.samples)
|
||||||
|
|
||||||
report = {
|
report = {
|
||||||
'optim_hyper': best_params,
|
'optim_hyper': best_params,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue