mlquantify 0.1.10__tar.gz → 0.1.12__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.10/mlquantify.egg-info → mlquantify-0.1.12}/PKG-INFO +10 -18
- {mlquantify-0.1.10 → mlquantify-0.1.12}/README.md +9 -17
- mlquantify-0.1.12/VERSION.txt +1 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/adjust_counting/_adjustment.py +6 -1
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/adjust_counting/_base.py +4 -1
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/meta/_classes.py +27 -17
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/mixture/_classes.py +4 -2
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/utils/_validation.py +3 -3
- {mlquantify-0.1.10 → mlquantify-0.1.12/mlquantify.egg-info}/PKG-INFO +10 -18
- mlquantify-0.1.10/VERSION.txt +0 -1
- {mlquantify-0.1.10 → mlquantify-0.1.12}/MANIFEST.in +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/__init__.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/adjust_counting/__init__.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/adjust_counting/_counting.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/adjust_counting/_utils.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/base.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/base_aggregative.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/calibration.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/confidence.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/likelihood/__init__.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/likelihood/_base.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/likelihood/_classes.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/meta/__init__.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/metrics/__init__.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/metrics/_oq.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/metrics/_rq.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/metrics/_slq.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/mixture/__init__.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/mixture/_base.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/mixture/_utils.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/model_selection/__init__.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/model_selection/_protocol.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/model_selection/_search.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/model_selection/_split.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/multiclass.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/neighbors/__init__.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/neighbors/_base.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/neighbors/_classes.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/neighbors/_classification.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/neighbors/_kde.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/neighbors/_utils.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/neural/__init__.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/utils/__init__.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/utils/_artificial.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/utils/_constraints.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/utils/_context.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/utils/_decorators.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/utils/_exceptions.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/utils/_get_scores.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/utils/_load.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/utils/_parallel.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/utils/_random.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/utils/_sampling.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/utils/_tags.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify/utils/prevalence.py +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify.egg-info/SOURCES.txt +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify.egg-info/dependency_links.txt +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify.egg-info/requires.txt +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/mlquantify.egg-info/top_level.txt +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/setup.cfg +0 -0
- {mlquantify-0.1.10 → mlquantify-0.1.12}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mlquantify
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.12
|
|
4
4
|
Summary: Quantification Library
|
|
5
5
|
Home-page: https://github.com/luizfernandolj/QuantifyML/tree/master
|
|
6
6
|
Maintainer: Luiz Fernando Luth Junior
|
|
@@ -30,7 +30,7 @@ Dynamic: maintainer
|
|
|
30
30
|
Dynamic: requires-dist
|
|
31
31
|
Dynamic: summary
|
|
32
32
|
|
|
33
|
-
<
|
|
33
|
+
<img src="assets/logo_mlquantify-white.svg" alt="mlquantify logo">
|
|
34
34
|
<h4 align="center">A Python Package for Quantification</h4>
|
|
35
35
|
|
|
36
36
|
___
|
|
@@ -41,7 +41,7 @@ ___
|
|
|
41
41
|
|
|
42
42
|
## Latest Release
|
|
43
43
|
|
|
44
|
-
- **Version 0.1.
|
|
44
|
+
- **Version 0.1.11**: Inicial beta version. For a detailed list of changes, check the [changelog](#).
|
|
45
45
|
- In case you need any help, refer to the [User Guide](https://luizfernandolj.github.io/mlquantify/user_guide.html).
|
|
46
46
|
- Explore the [API documentation](https://luizfernandolj.github.io/mlquantify/api/index.html) for detailed developer information.
|
|
47
47
|
- See also the library in the pypi site in [pypi mlquantify](https://pypi.org/project/mlquantify/)
|
|
@@ -73,7 +73,6 @@ ___
|
|
|
73
73
|
| **Model Selection** | Criteria and processes used to select the best model, such as grid-search for the case of quantification|
|
|
74
74
|
| **Evaluation Metrics** | Specific metrics used to evaluate quantification performance, (e.g., AE, MAE, NAE, SE, KLD, etc.). |
|
|
75
75
|
| **Evaluation Protocols** | Evaluation protocols used, based on sampling generation (e.g., APP, NPP, etc.).. |
|
|
76
|
-
| **Plotting Results** | Tools and techniques used to visualize results, such as the protocol results.|
|
|
77
76
|
| **Comprehensive Documentation** | Complete documentation of the project, including code, data, and results. |
|
|
78
77
|
|
|
79
78
|
___
|
|
@@ -84,8 +83,8 @@ This code first loads the breast cancer dataset from _sklearn_, which is then sp
|
|
|
84
83
|
|
|
85
84
|
```python
|
|
86
85
|
from mlquantify.methods import EMQ
|
|
87
|
-
from mlquantify.
|
|
88
|
-
from mlquantify.utils import
|
|
86
|
+
from mlquantify.metrics import MAE, NRAE
|
|
87
|
+
from mlquantify.utils import get_prev_from_labels
|
|
89
88
|
|
|
90
89
|
from sklearn.ensemble import RandomForestClassifier
|
|
91
90
|
from sklearn.datasets import load_breast_cancer
|
|
@@ -103,14 +102,14 @@ model.fit(X_train, y_train)
|
|
|
103
102
|
|
|
104
103
|
#Predict the class prevalence for X_test
|
|
105
104
|
pred_prevalence = model.predict(X_test)
|
|
106
|
-
real_prevalence =
|
|
105
|
+
real_prevalence = get_prev_from_labels(y_test)
|
|
107
106
|
|
|
108
107
|
#Get the error for the prediction
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
mae = MAE(real_prevalence, pred_prevalence)
|
|
109
|
+
nrae = NRAE(real_prevalence, pred_prevalence)
|
|
111
110
|
|
|
112
|
-
print(f"Absolute Error -> {ae}")
|
|
113
111
|
print(f"Mean Absolute Error -> {mae}")
|
|
112
|
+
print(f"Normalized Relative Absolute Error -> {nrae}")
|
|
114
113
|
```
|
|
115
114
|
|
|
116
115
|
___
|
|
@@ -129,13 +128,6 @@ ___
|
|
|
129
128
|
|
|
130
129
|
## Documentation
|
|
131
130
|
|
|
132
|
-
##### API is avaliable [here](https://luizfernandolj.github.io/mlquantify/api/
|
|
133
|
-
|
|
134
|
-
- [Methods](https://github.com/luizfernandolj/mlquantify/wiki/Methods)
|
|
135
|
-
- [Model Selection](https://github.com/luizfernandolj/mlquantify/wiki/Model-Selection)
|
|
136
|
-
- [Evaluation](https://github.com/luizfernandolj/mlquantify/wiki/Evaluation)
|
|
137
|
-
- [Plotting](https://github.com/luizfernandolj/mlquantify/wiki/Plotting)
|
|
138
|
-
- [Utilities](https://github.com/luizfernandolj/mlquantify/wiki/Utilities)
|
|
139
|
-
|
|
131
|
+
##### API is avaliable [here](https://luizfernandolj.github.io/mlquantify/api/)
|
|
140
132
|
|
|
141
133
|
___
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<
|
|
1
|
+
<img src="assets/logo_mlquantify-white.svg" alt="mlquantify logo">
|
|
2
2
|
<h4 align="center">A Python Package for Quantification</h4>
|
|
3
3
|
|
|
4
4
|
___
|
|
@@ -9,7 +9,7 @@ ___
|
|
|
9
9
|
|
|
10
10
|
## Latest Release
|
|
11
11
|
|
|
12
|
-
- **Version 0.1.
|
|
12
|
+
- **Version 0.1.11**: Inicial beta version. For a detailed list of changes, check the [changelog](#).
|
|
13
13
|
- In case you need any help, refer to the [User Guide](https://luizfernandolj.github.io/mlquantify/user_guide.html).
|
|
14
14
|
- Explore the [API documentation](https://luizfernandolj.github.io/mlquantify/api/index.html) for detailed developer information.
|
|
15
15
|
- See also the library in the pypi site in [pypi mlquantify](https://pypi.org/project/mlquantify/)
|
|
@@ -41,7 +41,6 @@ ___
|
|
|
41
41
|
| **Model Selection** | Criteria and processes used to select the best model, such as grid-search for the case of quantification|
|
|
42
42
|
| **Evaluation Metrics** | Specific metrics used to evaluate quantification performance, (e.g., AE, MAE, NAE, SE, KLD, etc.). |
|
|
43
43
|
| **Evaluation Protocols** | Evaluation protocols used, based on sampling generation (e.g., APP, NPP, etc.).. |
|
|
44
|
-
| **Plotting Results** | Tools and techniques used to visualize results, such as the protocol results.|
|
|
45
44
|
| **Comprehensive Documentation** | Complete documentation of the project, including code, data, and results. |
|
|
46
45
|
|
|
47
46
|
___
|
|
@@ -52,8 +51,8 @@ This code first loads the breast cancer dataset from _sklearn_, which is then sp
|
|
|
52
51
|
|
|
53
52
|
```python
|
|
54
53
|
from mlquantify.methods import EMQ
|
|
55
|
-
from mlquantify.
|
|
56
|
-
from mlquantify.utils import
|
|
54
|
+
from mlquantify.metrics import MAE, NRAE
|
|
55
|
+
from mlquantify.utils import get_prev_from_labels
|
|
57
56
|
|
|
58
57
|
from sklearn.ensemble import RandomForestClassifier
|
|
59
58
|
from sklearn.datasets import load_breast_cancer
|
|
@@ -71,14 +70,14 @@ model.fit(X_train, y_train)
|
|
|
71
70
|
|
|
72
71
|
#Predict the class prevalence for X_test
|
|
73
72
|
pred_prevalence = model.predict(X_test)
|
|
74
|
-
real_prevalence =
|
|
73
|
+
real_prevalence = get_prev_from_labels(y_test)
|
|
75
74
|
|
|
76
75
|
#Get the error for the prediction
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
mae = MAE(real_prevalence, pred_prevalence)
|
|
77
|
+
nrae = NRAE(real_prevalence, pred_prevalence)
|
|
79
78
|
|
|
80
|
-
print(f"Absolute Error -> {ae}")
|
|
81
79
|
print(f"Mean Absolute Error -> {mae}")
|
|
80
|
+
print(f"Normalized Relative Absolute Error -> {nrae}")
|
|
82
81
|
```
|
|
83
82
|
|
|
84
83
|
___
|
|
@@ -97,13 +96,6 @@ ___
|
|
|
97
96
|
|
|
98
97
|
## Documentation
|
|
99
98
|
|
|
100
|
-
##### API is avaliable [here](https://luizfernandolj.github.io/mlquantify/api/
|
|
101
|
-
|
|
102
|
-
- [Methods](https://github.com/luizfernandolj/mlquantify/wiki/Methods)
|
|
103
|
-
- [Model Selection](https://github.com/luizfernandolj/mlquantify/wiki/Model-Selection)
|
|
104
|
-
- [Evaluation](https://github.com/luizfernandolj/mlquantify/wiki/Evaluation)
|
|
105
|
-
- [Plotting](https://github.com/luizfernandolj/mlquantify/wiki/Plotting)
|
|
106
|
-
- [Utilities](https://github.com/luizfernandolj/mlquantify/wiki/Utilities)
|
|
107
|
-
|
|
99
|
+
##### API is avaliable [here](https://luizfernandolj.github.io/mlquantify/api/)
|
|
108
100
|
|
|
109
101
|
___
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.12
|
|
@@ -603,7 +603,12 @@ class MS(ThresholdAdjustment):
|
|
|
603
603
|
for thr, tpr, fpr in zip(thresholds, tprs, fprs):
|
|
604
604
|
cc_predictions = CC(thr).aggregate(predictions)
|
|
605
605
|
cc_predictions = cc_predictions[1]
|
|
606
|
-
|
|
606
|
+
|
|
607
|
+
if tpr - fpr == 0:
|
|
608
|
+
prevalence = cc_predictions
|
|
609
|
+
else:
|
|
610
|
+
prevalence = np.clip((cc_predictions - fpr) / (tpr - fpr), 0, 1)
|
|
611
|
+
|
|
607
612
|
prevs.append(prevalence)
|
|
608
613
|
prevalence = np.median(prevs)
|
|
609
614
|
return np.asarray([1 - prevalence, prevalence])
|
|
@@ -239,7 +239,10 @@ class BaseAdjustCount(AggregationMixin, BaseQuantifier):
|
|
|
239
239
|
def aggregate(self, predictions, train_predictions, y_train_values):
|
|
240
240
|
"""Aggregate predictions and apply matrix- or rate-based bias correction."""
|
|
241
241
|
self.classes_ = check_classes_attribute(self, np.unique(y_train_values))
|
|
242
|
-
|
|
242
|
+
|
|
243
|
+
predictions = validate_predictions(self, predictions)
|
|
244
|
+
train_predictions = validate_predictions(self, train_predictions)
|
|
245
|
+
|
|
243
246
|
prevalences = self._adjust(predictions, train_predictions, y_train_values)
|
|
244
247
|
prevalences = validate_prevalences(self, prevalences, self.classes_)
|
|
245
248
|
return prevalences
|
|
@@ -661,7 +661,7 @@ class QuaDapt(MetaquantifierMixin, BaseQuantifier):
|
|
|
661
661
|
def __init__(self,
|
|
662
662
|
quantifier,
|
|
663
663
|
measure="topsoe",
|
|
664
|
-
merging_factors=(0.1, 1.0, 0.2)):
|
|
664
|
+
merging_factors=np.arange(0.1, 1.0, 0.2)):
|
|
665
665
|
self.quantifier = quantifier
|
|
666
666
|
self.measure = measure
|
|
667
667
|
self.merging_factors = merging_factors
|
|
@@ -701,10 +701,7 @@ class QuaDapt(MetaquantifierMixin, BaseQuantifier):
|
|
|
701
701
|
|
|
702
702
|
self.classes = self.classes if hasattr(self, 'classes') else np.unique(train_y_values)
|
|
703
703
|
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
moss_scores = moss[:, :2]
|
|
707
|
-
moss_labels = moss[:, 2]
|
|
704
|
+
moss_scores, moss_labels = self.MoSS(1000, 0.5, m)
|
|
708
705
|
|
|
709
706
|
prevalences = self.quantifier.aggregate(predictions,
|
|
710
707
|
moss_scores,
|
|
@@ -721,9 +718,9 @@ class QuaDapt(MetaquantifierMixin, BaseQuantifier):
|
|
|
721
718
|
distances = []
|
|
722
719
|
|
|
723
720
|
for mf in MF:
|
|
724
|
-
scores =
|
|
725
|
-
pos_scores = scores[
|
|
726
|
-
neg_scores = scores[
|
|
721
|
+
scores, labels = self.MoSS(1000, 0.5, mf)
|
|
722
|
+
pos_scores = scores[labels == 1][:, 1]
|
|
723
|
+
neg_scores = scores[labels == 0][:, 1]
|
|
727
724
|
|
|
728
725
|
best_distance = self._get_best_distance(predictions, pos_scores, neg_scores)
|
|
729
726
|
|
|
@@ -772,14 +769,27 @@ class QuaDapt(MetaquantifierMixin, BaseQuantifier):
|
|
|
772
769
|
.. [1] Maletzke, A., Reis, D. dos, Hassan, W., & Batista, G. (2021).
|
|
773
770
|
Accurately Quantifying under Score Variability. 2021 IEEE International Conference on Data Mining (ICDM), 1228-1233. https://doi.org/10.1109/ICDM51629.2021.00149
|
|
774
771
|
"""
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
772
|
+
if isinstance(alpha, list):
|
|
773
|
+
alpha = float(alpha[1])
|
|
774
|
+
|
|
775
|
+
n_pos = int(n * alpha)
|
|
776
|
+
n_neg = n - n_pos
|
|
777
|
+
|
|
778
|
+
# Scores positivos
|
|
779
|
+
p_score = np.random.uniform(size=n_pos) ** merging_factor
|
|
780
|
+
# Scores negativos
|
|
781
|
+
n_score = 1 - (np.random.uniform(size=n_neg) ** merging_factor)
|
|
782
|
+
|
|
783
|
+
# Construção dos arrays de features (duas colunas iguais)
|
|
784
|
+
moss = np.column_stack(
|
|
785
|
+
(
|
|
786
|
+
1 - np.concatenate((p_score, n_score)),
|
|
787
|
+
np.concatenate((p_score, n_score)),
|
|
788
|
+
np.int16(np.concatenate((np.ones(len(p_score)), np.full(len(n_score), 0))))
|
|
789
|
+
)
|
|
783
790
|
)
|
|
784
|
-
|
|
791
|
+
|
|
792
|
+
scores = moss[:, :2]
|
|
793
|
+
labels = moss[:, 2].astype(np.int16)
|
|
794
|
+
return scores, labels
|
|
785
795
|
|
|
@@ -308,8 +308,10 @@ class SMM(AggregativeMixture):
|
|
|
308
308
|
mean_pos = np.mean(pos_scores)
|
|
309
309
|
mean_neg = np.mean(neg_scores)
|
|
310
310
|
mean_test = np.mean(predictions)
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
if mean_pos - mean_neg == 0:
|
|
312
|
+
alpha = mean_test
|
|
313
|
+
else:
|
|
314
|
+
alpha = np.clip((mean_test - mean_neg) / (mean_pos - mean_neg), 0, 1)
|
|
313
315
|
return alpha, None
|
|
314
316
|
|
|
315
317
|
|
|
@@ -274,7 +274,7 @@ def validate_data(quantifier,
|
|
|
274
274
|
else:
|
|
275
275
|
out = X, y
|
|
276
276
|
elif not no_val_X and no_val_y:
|
|
277
|
-
out = check_array(X, input_name="X", **check_params)
|
|
277
|
+
out = check_array(X, input_name="X", dtype=None, **check_params)
|
|
278
278
|
elif no_val_X and not no_val_y:
|
|
279
279
|
out = _check_y(y, **check_params)
|
|
280
280
|
else:
|
|
@@ -286,12 +286,12 @@ def validate_data(quantifier,
|
|
|
286
286
|
check_X_params, check_y_params = validate_separately
|
|
287
287
|
if "estimator" not in check_X_params:
|
|
288
288
|
check_X_params = {**default_check_params, **check_X_params}
|
|
289
|
-
X = check_array(X, input_name="X", **check_X_params)
|
|
289
|
+
X = check_array(X, input_name="X", dtype=None, **check_X_params)
|
|
290
290
|
if "estimator" not in check_y_params:
|
|
291
291
|
check_y_params = {**default_check_params, **check_y_params}
|
|
292
292
|
y = check_array(y, input_name="y", **check_y_params)
|
|
293
293
|
else:
|
|
294
|
-
X, y = check_X_y(X, y, **check_params)
|
|
294
|
+
X, y = check_X_y(X, y, dtype=None, **check_params)
|
|
295
295
|
out = X, y
|
|
296
296
|
|
|
297
297
|
return out
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mlquantify
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.12
|
|
4
4
|
Summary: Quantification Library
|
|
5
5
|
Home-page: https://github.com/luizfernandolj/QuantifyML/tree/master
|
|
6
6
|
Maintainer: Luiz Fernando Luth Junior
|
|
@@ -30,7 +30,7 @@ Dynamic: maintainer
|
|
|
30
30
|
Dynamic: requires-dist
|
|
31
31
|
Dynamic: summary
|
|
32
32
|
|
|
33
|
-
<
|
|
33
|
+
<img src="assets/logo_mlquantify-white.svg" alt="mlquantify logo">
|
|
34
34
|
<h4 align="center">A Python Package for Quantification</h4>
|
|
35
35
|
|
|
36
36
|
___
|
|
@@ -41,7 +41,7 @@ ___
|
|
|
41
41
|
|
|
42
42
|
## Latest Release
|
|
43
43
|
|
|
44
|
-
- **Version 0.1.
|
|
44
|
+
- **Version 0.1.11**: Inicial beta version. For a detailed list of changes, check the [changelog](#).
|
|
45
45
|
- In case you need any help, refer to the [User Guide](https://luizfernandolj.github.io/mlquantify/user_guide.html).
|
|
46
46
|
- Explore the [API documentation](https://luizfernandolj.github.io/mlquantify/api/index.html) for detailed developer information.
|
|
47
47
|
- See also the library in the pypi site in [pypi mlquantify](https://pypi.org/project/mlquantify/)
|
|
@@ -73,7 +73,6 @@ ___
|
|
|
73
73
|
| **Model Selection** | Criteria and processes used to select the best model, such as grid-search for the case of quantification|
|
|
74
74
|
| **Evaluation Metrics** | Specific metrics used to evaluate quantification performance, (e.g., AE, MAE, NAE, SE, KLD, etc.). |
|
|
75
75
|
| **Evaluation Protocols** | Evaluation protocols used, based on sampling generation (e.g., APP, NPP, etc.).. |
|
|
76
|
-
| **Plotting Results** | Tools and techniques used to visualize results, such as the protocol results.|
|
|
77
76
|
| **Comprehensive Documentation** | Complete documentation of the project, including code, data, and results. |
|
|
78
77
|
|
|
79
78
|
___
|
|
@@ -84,8 +83,8 @@ This code first loads the breast cancer dataset from _sklearn_, which is then sp
|
|
|
84
83
|
|
|
85
84
|
```python
|
|
86
85
|
from mlquantify.methods import EMQ
|
|
87
|
-
from mlquantify.
|
|
88
|
-
from mlquantify.utils import
|
|
86
|
+
from mlquantify.metrics import MAE, NRAE
|
|
87
|
+
from mlquantify.utils import get_prev_from_labels
|
|
89
88
|
|
|
90
89
|
from sklearn.ensemble import RandomForestClassifier
|
|
91
90
|
from sklearn.datasets import load_breast_cancer
|
|
@@ -103,14 +102,14 @@ model.fit(X_train, y_train)
|
|
|
103
102
|
|
|
104
103
|
#Predict the class prevalence for X_test
|
|
105
104
|
pred_prevalence = model.predict(X_test)
|
|
106
|
-
real_prevalence =
|
|
105
|
+
real_prevalence = get_prev_from_labels(y_test)
|
|
107
106
|
|
|
108
107
|
#Get the error for the prediction
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
mae = MAE(real_prevalence, pred_prevalence)
|
|
109
|
+
nrae = NRAE(real_prevalence, pred_prevalence)
|
|
111
110
|
|
|
112
|
-
print(f"Absolute Error -> {ae}")
|
|
113
111
|
print(f"Mean Absolute Error -> {mae}")
|
|
112
|
+
print(f"Normalized Relative Absolute Error -> {nrae}")
|
|
114
113
|
```
|
|
115
114
|
|
|
116
115
|
___
|
|
@@ -129,13 +128,6 @@ ___
|
|
|
129
128
|
|
|
130
129
|
## Documentation
|
|
131
130
|
|
|
132
|
-
##### API is avaliable [here](https://luizfernandolj.github.io/mlquantify/api/
|
|
133
|
-
|
|
134
|
-
- [Methods](https://github.com/luizfernandolj/mlquantify/wiki/Methods)
|
|
135
|
-
- [Model Selection](https://github.com/luizfernandolj/mlquantify/wiki/Model-Selection)
|
|
136
|
-
- [Evaluation](https://github.com/luizfernandolj/mlquantify/wiki/Evaluation)
|
|
137
|
-
- [Plotting](https://github.com/luizfernandolj/mlquantify/wiki/Plotting)
|
|
138
|
-
- [Utilities](https://github.com/luizfernandolj/mlquantify/wiki/Utilities)
|
|
139
|
-
|
|
131
|
+
##### API is avaliable [here](https://luizfernandolj.github.io/mlquantify/api/)
|
|
140
132
|
|
|
141
133
|
___
|
mlquantify-0.1.10/VERSION.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.1.10
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|