A Python framework for Quantification
Go to file
Alejandro Moreo Fernandez 301e8b9088 adding uci ml datasets 2021-01-25 18:38:56 +01:00
NewMethods experimental method ave-pool, not working due to the fact that onevsall is aggregative and ave-pool is not 2021-01-20 17:03:12 +01:00
TweetSentQuant parallel in threading mode (another) 2021-01-25 16:46:59 +01:00
quapy adding uci ml datasets 2021-01-25 18:38:56 +01:00
.gitignore data loading 2020-12-03 16:24:21 +01:00
LICENSE license updated 2020-12-15 13:36:24 +01:00
README.md refactor: methods requiring a val_split can now declare a default value in the __init__ method that will be used in case the fit method is called without specifying the val_split, which now is by default None in the fit, i.e., by default takes the value of the init, that is generally set to 0.4; some uci datasets added; ensembles can now be optimized for quantification, and can be trained on samples of smaller size 2021-01-22 18:01:51 +01:00
TODO.txt refactor: methods requiring a val_split can now declare a default value in the __init__ method that will be used in case the fit method is called without specifying the val_split, which now is by default None in the fit, i.e., by default takes the value of the init, that is generally set to 0.4; some uci datasets added; ensembles can now be optimized for quantification, and can be trained on samples of smaller size 2021-01-22 18:01:51 +01:00
plot_example.py plot functionality added 2021-01-07 17:58:48 +01:00
prepare_svmperf.sh cleaning 2020-12-15 15:28:20 +01:00
svm-perf-quantification-ext.patch many aggregative methods added 2020-12-03 18:12:28 +01:00
test.py adding uci ml datasets 2021-01-25 18:38:56 +01:00

README.md

QuaPy

QuaPy is an open source framework for Quantification (a.k.a. Supervised Prevalence Estimation) written in Python.

QuaPy roots on the concept of data sample, and provides implementations of most important concepts in quantification literature, such as the most important quantification baselines, many advanced quantification methods, quantification-oriented model selection, many evaluation measures and protocols used for evaluating quantification methods. QuaPy also integrates commonly used datasets and offers visualization tools for facilitating the analysis and interpretation of results.

import quapy as qp
from sklearn.linear_model import LogisticRegression

dataset = qp.datasets.fetch_twitter('semeval16')

# create an "Adjusted Classify & Count" quantifier
model = qp.method.aggregative.ACC(LogisticRegression())
model.fit(dataset.training)

prevalences_estim = model.quantify(dataset.test.instances)
prevalences_true  = dataset.test.prevalence()

error = qp.error.mae(prevalences_true, prevalences_estim)

print(f'MAE={error:.3f}')

binary, and single-label