mlquantify 0.0.11.9__tar.gz → 0.0.11.10__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.0.11.9 → mlquantify-0.0.11.10}/PKG-INFO +1 -1
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/__init__.py +9 -6
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/base.py +2 -2
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/methods/aggregative.py +4 -4
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/methods/mixture_models.py +2 -2
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/methods/threshold_optimization.py +2 -2
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify.egg-info/PKG-INFO +1 -1
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/setup.py +1 -1
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/README.md +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/classification/__init__.py +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/classification/methods.py +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/evaluation/__init__.py +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/evaluation/measures.py +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/evaluation/protocol.py +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/methods/__init__.py +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/methods/meta.py +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/methods/non_aggregative.py +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/model_selection.py +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/plots.py +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/utils/__init__.py +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/utils/general.py +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify/utils/method.py +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify.egg-info/SOURCES.txt +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify.egg-info/dependency_links.txt +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify.egg-info/requires.txt +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/mlquantify.egg-info/top_level.txt +0 -0
- {mlquantify-0.0.11.9 → mlquantify-0.0.11.10}/setup.cfg +0 -0
|
@@ -12,16 +12,19 @@ ARGUMENTS_SETTED = False
|
|
|
12
12
|
|
|
13
13
|
arguments = {
|
|
14
14
|
"y_pred": None,
|
|
15
|
-
"
|
|
15
|
+
"posteriors_train": None,
|
|
16
|
+
"posteriors_test": None,
|
|
16
17
|
"y_labels": None,
|
|
17
|
-
"
|
|
18
|
+
"y_pred_train": None,
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
def set_arguments(y_pred=None,
|
|
21
|
+
def set_arguments(y_pred=None, posteriors_train=None, posteriors_test=None, y_labels=None, y_pred_train=None):
|
|
21
22
|
global ARGUMENTS_SETTED
|
|
22
23
|
global arguments
|
|
23
24
|
arguments["y_pred"] = y_pred
|
|
24
|
-
arguments["
|
|
25
|
+
arguments["posteriors_train"] = posteriors_train
|
|
26
|
+
arguments["posteriors_test"] = posteriors_test
|
|
25
27
|
arguments["y_labels"] = y_labels
|
|
26
|
-
arguments["
|
|
27
|
-
|
|
28
|
+
arguments["y_pred_train"] = y_pred_train
|
|
29
|
+
|
|
30
|
+
ARGUMENTS_SETTED = True
|
|
@@ -315,7 +315,7 @@ class AggregativeQuantifier(Quantifier, ABC):
|
|
|
315
315
|
Training labels.
|
|
316
316
|
"""
|
|
317
317
|
if mq.ARGUMENTS_SETTED:
|
|
318
|
-
if self.is_probabilistic and mq.arguments["
|
|
318
|
+
if self.is_probabilistic and mq.arguments["posteriors_test"] is not None:
|
|
319
319
|
return
|
|
320
320
|
elif not self.is_probabilistic and mq.arguments["y_pred"] is not None:
|
|
321
321
|
return
|
|
@@ -343,7 +343,7 @@ class AggregativeQuantifier(Quantifier, ABC):
|
|
|
343
343
|
else:
|
|
344
344
|
if mq.ARGUMENTS_SETTED:
|
|
345
345
|
if self.is_probabilistic:
|
|
346
|
-
return mq.arguments["
|
|
346
|
+
return mq.arguments["posteriors_test"]
|
|
347
347
|
return mq.arguments["y_pred"]
|
|
348
348
|
else:
|
|
349
349
|
raise ValueError("No learner object was set and no arguments were setted")
|
|
@@ -385,9 +385,9 @@ class FM(AggregativeQuantifier):
|
|
|
385
385
|
The fitted instance of FM.
|
|
386
386
|
"""
|
|
387
387
|
# Get predicted labels and probabilities using cross-validation
|
|
388
|
-
if mq.arguments["y_labels"] is not None and mq.arguments["
|
|
388
|
+
if mq.arguments["y_labels"] is not None and mq.arguments["posteriors_train"] is not None:
|
|
389
389
|
y_labels = mq.arguments["y_labels"]
|
|
390
|
-
probabilities = mq.arguments["
|
|
390
|
+
probabilities = mq.arguments["posteriors_train"]
|
|
391
391
|
else:
|
|
392
392
|
y_labels, probabilities = get_scores(X, y, self.learner, self.cv_folds, self.learner_fitted)
|
|
393
393
|
|
|
@@ -548,7 +548,7 @@ class GAC(AggregativeQuantifier):
|
|
|
548
548
|
y = pd.Series(y)
|
|
549
549
|
|
|
550
550
|
if self.learner_fitted or self.learner is None:
|
|
551
|
-
y_pred = mq.arguments["
|
|
551
|
+
y_pred = mq.arguments["y_pred_train"] if mq.arguments["y_pred_train"] is not None else self.predict_learner(X)
|
|
552
552
|
y_label = y
|
|
553
553
|
else:
|
|
554
554
|
X_train, X_val, y_train, y_val = train_test_split(
|
|
@@ -731,7 +731,7 @@ class GPAC(AggregativeQuantifier):
|
|
|
731
731
|
y = pd.Series(y)
|
|
732
732
|
|
|
733
733
|
if self.learner_fitted or self.learner is None:
|
|
734
|
-
y_pred = mq.arguments["
|
|
734
|
+
y_pred = mq.arguments["y_pred_train"] if mq.arguments["y_pred_train"] is not None else self.predict_learner(X)
|
|
735
735
|
y_labels = y
|
|
736
736
|
else:
|
|
737
737
|
X_train, X_val, y_train, y_val = train_test_split(
|
|
@@ -107,9 +107,9 @@ class MixtureModel(AggregativeQuantifier):
|
|
|
107
107
|
self : MixtureModel
|
|
108
108
|
The fitted MixtureModel instance.
|
|
109
109
|
"""
|
|
110
|
-
if mq.arguments["y_labels"] is not None and mq.arguments["
|
|
110
|
+
if mq.arguments["y_labels"] is not None and mq.arguments["posteriors_train"] is not None:
|
|
111
111
|
y_labels = mq.arguments["y_labels"]
|
|
112
|
-
probabilities = mq.arguments["
|
|
112
|
+
probabilities = mq.arguments["posteriors_train"]
|
|
113
113
|
else:
|
|
114
114
|
y_labels, probabilities = get_scores(X, y, self.learner, self.cv_folds, self.learner_fitted)
|
|
115
115
|
|
|
@@ -122,9 +122,9 @@ class ThresholdOptimization(AggregativeQuantifier):
|
|
|
122
122
|
The fitted quantifier object with the best threshold, TPR, and FPR.
|
|
123
123
|
"""
|
|
124
124
|
# Get predicted labels and probabilities
|
|
125
|
-
if mq.arguments["y_labels"] is not None and mq.arguments["
|
|
125
|
+
if mq.arguments["y_labels"] is not None and mq.arguments["posteriors_train"] is not None:
|
|
126
126
|
y_labels = mq.arguments["y_labels"]
|
|
127
|
-
probabilities = mq.arguments["
|
|
127
|
+
probabilities = mq.arguments["posteriors_train"]
|
|
128
128
|
else:
|
|
129
129
|
y_labels, probabilities = get_scores(X, y, self.learner, self.cv_folds, self.learner_fitted)
|
|
130
130
|
|
|
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
|