1
0
Fork 0

some minor improvements

This commit is contained in:
Alejandro Moreo Fernandez 2023-02-28 10:25:46 +01:00
parent 3779bb2123
commit 368ee03fbc
2 changed files with 8 additions and 7 deletions

View File

@ -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

View File

@ -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}