cleaning basic
This commit is contained in:
parent
265fcc2d92
commit
92f1fd2020
|
|
@ -6,6 +6,7 @@ import numpy as np
|
||||||
from sklearn.linear_model import LogisticRegression
|
from sklearn.linear_model import LogisticRegression
|
||||||
|
|
||||||
import quapy as qp
|
import quapy as qp
|
||||||
|
from quapy.method.aggregative import PACC
|
||||||
|
|
||||||
# let's fetch some dataset to run one experiment
|
# let's fetch some dataset to run one experiment
|
||||||
# datasets are available in the "qp.data.datasets" module (there is a shortcut in qp.datasets)
|
# datasets are available in the "qp.data.datasets" module (there is a shortcut in qp.datasets)
|
||||||
|
|
@ -34,7 +35,7 @@ print(f'training prevalence = {F.strprev(train.prevalence())}')
|
||||||
|
|
||||||
# let us train one quantifier, for example, PACC using a sklearn's Logistic Regressor as the underlying classifier
|
# let us train one quantifier, for example, PACC using a sklearn's Logistic Regressor as the underlying classifier
|
||||||
classifier = LogisticRegression()
|
classifier = LogisticRegression()
|
||||||
pacc = qp.method.aggregative.PACC(classifier)
|
pacc = PACC(classifier)
|
||||||
|
|
||||||
print(f'training {pacc}')
|
print(f'training {pacc}')
|
||||||
pacc.fit(X, y)
|
pacc.fit(X, y)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@ print(f'running model selection with N_JOBS={qp.environ["N_JOBS"]}; '
|
||||||
training, test = qp.datasets.fetch_UCIMulticlassDataset('letter').train_test
|
training, test = qp.datasets.fetch_UCIMulticlassDataset('letter').train_test
|
||||||
|
|
||||||
# evaluation in terms of MAE with default hyperparameters
|
# evaluation in terms of MAE with default hyperparameters
|
||||||
model.fit(*training.Xy)
|
Xtr, ytr = training.Xy
|
||||||
|
model.fit(Xtr, ytr)
|
||||||
mae_score = qp.evaluation.evaluate(model, protocol=UPP(test), error_metric='mae')
|
mae_score = qp.evaluation.evaluate(model, protocol=UPP(test), error_metric='mae')
|
||||||
print(f'MAE (non optimized)={mae_score:.5f}')
|
print(f'MAE (non optimized)={mae_score:.5f}')
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue