mlquantify 0.1.4__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mlquantify-0.1.4/mlquantify.egg-info → mlquantify-0.1.6}/PKG-INFO +1 -1
- mlquantify-0.1.6/VERSION.txt +1 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/evaluation/protocol.py +4 -10
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/methods/meta.py +2 -2
- {mlquantify-0.1.4 → mlquantify-0.1.6/mlquantify.egg-info}/PKG-INFO +1 -1
- mlquantify-0.1.4/VERSION.txt +0 -1
- {mlquantify-0.1.4 → mlquantify-0.1.6}/MANIFEST.in +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/README.md +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/__init__.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/base.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/classification/__init__.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/classification/methods.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/evaluation/__init__.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/evaluation/measures.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/methods/__init__.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/methods/aggregative.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/methods/mixture_models.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/methods/non_aggregative.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/methods/threshold_optimization.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/model_selection.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/plots.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/utils/__init__.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/utils/general.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify/utils/method.py +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify.egg-info/SOURCES.txt +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify.egg-info/dependency_links.txt +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify.egg-info/requires.txt +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/mlquantify.egg-info/top_level.txt +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/setup.cfg +0 -0
- {mlquantify-0.1.4 → mlquantify-0.1.6}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.6
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
|
+
from logging import warning
|
|
2
3
|
import numpy as np
|
|
3
4
|
from typing import Generator, Tuple
|
|
4
5
|
from tqdm import tqdm
|
|
@@ -77,18 +78,11 @@ class Protocol(ABC):
|
|
|
77
78
|
Generator[np.ndarray, np.ndarray]
|
|
78
79
|
A generator that yields the indices for each split.
|
|
79
80
|
"""
|
|
80
|
-
indices = np.arange(X.shape[0])
|
|
81
|
-
for idx in self._split_indices_masks(X, y):
|
|
82
|
-
indexes = indices[idx]
|
|
83
|
-
yield indexes
|
|
84
|
-
|
|
85
|
-
def _split_indices_masks(self, X: np.ndarray, y: np.ndarray) -> Generator[Tuple[np.ndarray, np.ndarray]]:
|
|
86
81
|
for idx in self._iter_indices(X, y):
|
|
82
|
+
if len(idx) > len(X):
|
|
83
|
+
warning(f"Batch size {len(idx)} exceeds dataset size {len(X)}. Replacement sampling will be used.")
|
|
84
|
+
yield idx
|
|
87
85
|
|
|
88
|
-
mask = np.zeros(X.shape[0], dtype=bool)
|
|
89
|
-
mask[idx] = True
|
|
90
|
-
|
|
91
|
-
yield mask
|
|
92
86
|
|
|
93
87
|
@abstractmethod
|
|
94
88
|
def _iter_indices(self, X, y):
|
|
@@ -7,7 +7,7 @@ from sklearn.model_selection import GridSearchCV, cross_val_predict
|
|
|
7
7
|
from ..evaluation import measures
|
|
8
8
|
from ..base import Quantifier
|
|
9
9
|
from ..utils.method import getHist, hellinger
|
|
10
|
-
from ..utils.general import make_prevs, normalize_prevalence, parallel,
|
|
10
|
+
from ..utils.general import make_prevs, normalize_prevalence, parallel, get_indexes_with_prevalence
|
|
11
11
|
|
|
12
12
|
class Ensemble(Quantifier):
|
|
13
13
|
"""Ensemble of Quantification Models.
|
|
@@ -401,7 +401,7 @@ def _delayed_new_sample(args):
|
|
|
401
401
|
print(f'\tfit-start for prev {str(np.round(prev, 3))}, sample_size={sample_size}')
|
|
402
402
|
model = deepcopy(base_quantifier)
|
|
403
403
|
|
|
404
|
-
sample_index =
|
|
404
|
+
sample_index = get_indexes_with_prevalence(y, prev, sample_size)
|
|
405
405
|
X_sample = np.take(X, sample_index, axis=0)
|
|
406
406
|
y_sample = np.take(y, sample_index, axis=0)
|
|
407
407
|
#print(X_sample)
|
mlquantify-0.1.4/VERSION.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.1.4
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|