From 368ee03fbc5f31e6a0e964dae4565e80380eba83 Mon Sep 17 00:00:00 2001 From: Alejandro Moreo Date: Tue, 28 Feb 2023 10:25:46 +0100 Subject: [PATCH] some minor improvements --- quapy/__init__.py | 12 ++++++------ quapy/classification/methods.py | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/quapy/__init__.py b/quapy/__init__.py index 47a7388..72218e5 100644 --- a/quapy/__init__.py +++ b/quapy/__init__.py @@ -1,6 +1,7 @@ +"""QuaPy module for quantification""" +from quapy.data import datasets from . import error from . import data -from quapy.data import datasets from . import functional # from . import method from . import evaluation @@ -25,7 +26,8 @@ environ = { def _get_njobs(n_jobs): """ - If `n_jobs` is None, then it returns `environ['N_JOBS']`; if otherwise, returns `n_jobs`. + If `n_jobs` is None, then it returns `environ['N_JOBS']`; + if otherwise, returns `n_jobs`. :param n_jobs: the number of `n_jobs` or None if not specified :return: int @@ -35,7 +37,8 @@ def _get_njobs(n_jobs): def _get_sample_size(sample_size): """ - If `sample_size` is None, then it returns `environ['SAMPLE_SIZE']`; if otherwise, returns `sample_size`. + If `sample_size` is None, then it returns `environ['SAMPLE_SIZE']`; + if otherwise, returns `sample_size`. If none of these are set, then a ValueError exception is raised. :param sample_size: integer or None @@ -45,6 +48,3 @@ def _get_sample_size(sample_size): if sample_size is None: raise ValueError('neither sample_size nor qp.environ["SAMPLE_SIZE"] have been specified') return sample_size - - - diff --git a/quapy/classification/methods.py b/quapy/classification/methods.py index 01f4654..e26e990 100644 --- a/quapy/classification/methods.py +++ b/quapy/classification/methods.py @@ -21,10 +21,11 @@ class LowRankLogisticRegression(BaseEstimator): self.n_components = n_components self.learner = LogisticRegression(**kwargs) - def get_params(self): + def get_params(self, deep=True): """ Get hyper-parameters for this estimator. + :param deep: compatibility with sklearn :return: a dictionary with parameter names mapped to their values """ params = {'n_components': self.n_components}