2023-02-28 10:25:46 +01:00
|
|
|
"""QuaPy module for quantification"""
|
|
|
|
from quapy.data import datasets
|
2021-01-06 14:58:29 +01:00
|
|
|
from . import error
|
2021-01-15 18:32:32 +01:00
|
|
|
from . import data
|
2020-12-03 18:12:28 +01:00
|
|
|
from . import functional
|
2022-05-25 19:14:33 +02:00
|
|
|
# from . import method
|
2020-12-10 19:04:33 +01:00
|
|
|
from . import evaluation
|
2022-05-25 19:14:33 +02:00
|
|
|
from . import protocol
|
2021-01-07 17:58:48 +01:00
|
|
|
from . import plot
|
|
|
|
from . import util
|
2021-01-11 18:31:12 +01:00
|
|
|
from . import model_selection
|
2021-01-18 19:14:04 +01:00
|
|
|
from . import classification
|
2020-12-29 20:33:59 +01:00
|
|
|
|
2023-11-09 14:20:41 +01:00
|
|
|
__version__ = '0.1.8'
|
2021-01-27 22:49:54 +01:00
|
|
|
|
2020-12-29 20:33:59 +01:00
|
|
|
environ = {
|
|
|
|
'SAMPLE_SIZE': None,
|
|
|
|
'UNK_TOKEN': '[UNK]',
|
|
|
|
'UNK_INDEX': 0,
|
|
|
|
'PAD_TOKEN': '[PAD]',
|
|
|
|
'PAD_INDEX': 1,
|
2022-06-14 09:35:39 +02:00
|
|
|
'SVMPERF_HOME': './svm_perf_quantification',
|
|
|
|
'N_JOBS': 1
|
2020-12-29 20:33:59 +01:00
|
|
|
}
|
|
|
|
|
2022-05-25 19:14:33 +02:00
|
|
|
|
2023-02-08 19:06:53 +01:00
|
|
|
def _get_njobs(n_jobs):
|
|
|
|
"""
|
2023-02-28 10:25:46 +01:00
|
|
|
If `n_jobs` is None, then it returns `environ['N_JOBS']`;
|
|
|
|
if otherwise, returns `n_jobs`.
|
2023-02-08 19:06:53 +01:00
|
|
|
|
|
|
|
:param n_jobs: the number of `n_jobs` or None if not specified
|
|
|
|
:return: int
|
|
|
|
"""
|
2022-06-14 09:35:39 +02:00
|
|
|
return environ['N_JOBS'] if n_jobs is None else n_jobs
|
|
|
|
|
|
|
|
|
2023-02-08 19:06:53 +01:00
|
|
|
def _get_sample_size(sample_size):
|
|
|
|
"""
|
2023-02-28 10:25:46 +01:00
|
|
|
If `sample_size` is None, then it returns `environ['SAMPLE_SIZE']`;
|
|
|
|
if otherwise, returns `sample_size`.
|
2023-02-08 19:06:53 +01:00
|
|
|
If none of these are set, then a ValueError exception is raised.
|
|
|
|
|
|
|
|
:param sample_size: integer or None
|
|
|
|
:return: int
|
|
|
|
"""
|
|
|
|
sample_size = environ['SAMPLE_SIZE'] if sample_size is None else sample_size
|
|
|
|
if sample_size is None:
|
|
|
|
raise ValueError('neither sample_size nor qp.environ["SAMPLE_SIZE"] have been specified')
|
|
|
|
return sample_size
|