first example
This commit is contained in:
parent
a6ff00f96b
commit
af2c4eaf01
|
@ -0,0 +1,30 @@
|
|||
import numpy as np
|
||||
|
||||
import quapy as qp
|
||||
from protocol import UPP
|
||||
from quapy.method.aggregative import KDEyML
|
||||
|
||||
qp.environ["SAMPLE_SIZE"]=500
|
||||
|
||||
|
||||
def datasets():
|
||||
for dataset_name in qp.datasets.UCI_MULTICLASS_DATASETS:
|
||||
yield qp.datasets.fetch_UCIMulticlassDataset(dataset_name)
|
||||
|
||||
|
||||
for dataset in datasets():
|
||||
train, test = dataset.train_test
|
||||
test_gen = UPP(test, repeats=500)
|
||||
|
||||
print(f"testing KDEy in {dataset.name}")
|
||||
for b in np.linspace(0.01, 20, 20):
|
||||
kdey = KDEyML(bandwidth=b, random_state=0)
|
||||
kdey.fit(train)
|
||||
|
||||
report = qp.evaluation.evaluation_report(kdey, protocol=test_gen, error_metrics=['ae', 'rae', 'kld'], verbose=True)
|
||||
print(f'bandwidth={b}')
|
||||
print(f'MAE={report["ae"].mean()}')
|
||||
print(f'MRAE={report["ae"].mean()}')
|
||||
|
||||
|
||||
|
|
@ -637,7 +637,7 @@ def fetch_UCIMulticlassDataset(
|
|||
if n_train > max_train_instances:
|
||||
train_prop = (max_train_instances / n)
|
||||
|
||||
data = Dataset(*data.split_stratified(train_prop, random_state=0))
|
||||
data = Dataset(*data.split_stratified(train_prop, random_state=0), name=dataset_name)
|
||||
|
||||
if standardize:
|
||||
data = standardizer(data)
|
||||
|
|
Loading…
Reference in New Issue