mlquantify 0.0.11.1__tar.gz → 0.0.11.3__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.
Files changed (78) hide show
  1. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/PKG-INFO +2 -1
  2. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/README.md +1 -0
  3. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/plots/distribution_plot.py +54 -14
  4. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/plots/protocol_plot.py +38 -2
  5. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify.egg-info/PKG-INFO +2 -1
  6. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/setup.py +1 -1
  7. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/__init__.py +0 -0
  8. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/base.py +0 -0
  9. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/classification/__init__.py +0 -0
  10. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/classification/pwkclf.py +0 -0
  11. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/__init__.py +0 -0
  12. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/measures/__init__.py +0 -0
  13. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/measures/ae.py +0 -0
  14. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/measures/bias.py +0 -0
  15. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/measures/kld.py +0 -0
  16. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/measures/mse.py +0 -0
  17. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/measures/nae.py +0 -0
  18. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/measures/nkld.py +0 -0
  19. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/measures/nrae.py +0 -0
  20. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/measures/rae.py +0 -0
  21. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/measures/se.py +0 -0
  22. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/protocol/_Protocol.py +0 -0
  23. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/protocol/__init__.py +0 -0
  24. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/protocol/app.py +0 -0
  25. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/evaluation/protocol/npp.py +0 -0
  26. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/__init__.py +0 -0
  27. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/ThreholdOptm/_ThreholdOptimization.py +0 -0
  28. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/ThreholdOptm/__init__.py +0 -0
  29. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/ThreholdOptm/acc.py +0 -0
  30. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/ThreholdOptm/max.py +0 -0
  31. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/ThreholdOptm/ms.py +0 -0
  32. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/ThreholdOptm/ms2.py +0 -0
  33. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/ThreholdOptm/pacc.py +0 -0
  34. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/ThreholdOptm/t50.py +0 -0
  35. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/ThreholdOptm/x.py +0 -0
  36. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/__init__.py +0 -0
  37. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/cc.py +0 -0
  38. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/emq.py +0 -0
  39. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/fm.py +0 -0
  40. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/gac.py +0 -0
  41. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/gpac.py +0 -0
  42. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/mixtureModels/_MixtureModel.py +0 -0
  43. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/mixtureModels/__init__.py +0 -0
  44. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/mixtureModels/dys.py +0 -0
  45. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/mixtureModels/dys_syn.py +0 -0
  46. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/mixtureModels/hdy.py +0 -0
  47. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/mixtureModels/smm.py +0 -0
  48. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/mixtureModels/sord.py +0 -0
  49. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/pcc.py +0 -0
  50. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/aggregative/pwk.py +0 -0
  51. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/meta/__init__.py +0 -0
  52. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/meta/ensemble.py +0 -0
  53. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/non_aggregative/__init__.py +0 -0
  54. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/methods/non_aggregative/hdx.py +0 -0
  55. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/model_selection.py +0 -0
  56. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/plots/__init__.py +0 -0
  57. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/__init__.py +0 -0
  58. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/general_purposes/__init__.py +0 -0
  59. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/general_purposes/convert_col_to_array.py +0 -0
  60. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/general_purposes/generate_artificial_indexes.py +0 -0
  61. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/general_purposes/get_real_prev.py +0 -0
  62. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/general_purposes/load_quantifier.py +0 -0
  63. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/general_purposes/make_prevs.py +0 -0
  64. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/general_purposes/normalize.py +0 -0
  65. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/general_purposes/parallel.py +0 -0
  66. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/general_purposes/round_protocol_df.py +0 -0
  67. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/method_purposes/__init__.py +0 -0
  68. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/method_purposes/distances.py +0 -0
  69. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/method_purposes/getHist.py +0 -0
  70. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/method_purposes/get_scores.py +0 -0
  71. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/method_purposes/moss.py +0 -0
  72. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/method_purposes/ternary_search.py +0 -0
  73. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify/utils/method_purposes/tprfpr.py +0 -0
  74. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify.egg-info/SOURCES.txt +0 -0
  75. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify.egg-info/dependency_links.txt +0 -0
  76. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify.egg-info/requires.txt +0 -0
  77. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/mlquantify.egg-info/top_level.txt +0 -0
  78. {mlquantify-0.0.11.1 → mlquantify-0.0.11.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mlquantify
3
- Version: 0.0.11.1
3
+ Version: 0.0.11.3
4
4
  Summary: Quantification Library
5
5
  Home-page: https://github.com/luizfernandolj/QuantifyML/tree/master
6
6
  Maintainer: Luiz Fernando Luth Junior
@@ -109,6 +109,7 @@ ___
109
109
  - [Model Selection](https://github.com/luizfernandolj/mlquantify/wiki/Model-Selection)
110
110
  - [Evaluation](https://github.com/luizfernandolj/mlquantify/wiki/Evaluation)
111
111
  - [Plotting](https://github.com/luizfernandolj/mlquantify/wiki/Plotting)
112
+ - [Utilities](https://github.com/luizfernandolj/mlquantify/wiki/Utilities)
112
113
 
113
114
 
114
115
  ___
@@ -94,6 +94,7 @@ ___
94
94
  - [Model Selection](https://github.com/luizfernandolj/mlquantify/wiki/Model-Selection)
95
95
  - [Evaluation](https://github.com/luizfernandolj/mlquantify/wiki/Evaluation)
96
96
  - [Plotting](https://github.com/luizfernandolj/mlquantify/wiki/Plotting)
97
+ - [Utilities](https://github.com/luizfernandolj/mlquantify/wiki/Utilities)
97
98
 
98
99
 
99
100
  ___
@@ -30,8 +30,6 @@ plt.rcParams.update({
30
30
  })
31
31
 
32
32
 
33
-
34
-
35
33
  COLORS = [
36
34
  '#FFAB91', '#FFE082', '#A5D6A7', '#4DD0E1', '#FF6F61', '#FF8C94', '#D4A5A5',
37
35
  '#FF677D', '#B9FBC0', '#C2C2F0', '#E3F9A6', '#E2A8F7', '#F7B7A3', '#F7C6C7',
@@ -40,6 +38,7 @@ COLORS = [
40
38
  '#4FC3F7', '#FFB3B3', '#FF6F61'
41
39
  ]
42
40
 
41
+
43
42
  def class_distribution_plot(values: Union[List, np.ndarray],
44
43
  labels: Union[List, np.ndarray],
45
44
  bins: int = 30,
@@ -47,7 +46,6 @@ def class_distribution_plot(values: Union[List, np.ndarray],
47
46
  legend: bool = True,
48
47
  save_path: Optional[str] = None,
49
48
  plot_params: Optional[Dict[str, Any]] = None):
50
-
51
49
  """Plot overlaid histograms of class distributions.
52
50
 
53
51
  This function creates a plot with overlaid histograms, each representing the distribution
@@ -76,30 +74,72 @@ def class_distribution_plot(values: Union[List, np.ndarray],
76
74
  If the number of labels does not match the number of value sets.
77
75
 
78
76
  """
79
-
80
-
77
+
78
+ # Ensure the number of labels matches the number of value sets
79
+ assert len(values) == len(labels), "The number of value sets must match the number of labels."
80
+
81
+ if isinstance(values, list):
82
+ values = np.asarray(values)
83
+ if isinstance(labels, list):
84
+ labels = np.asarray(labels)
85
+
86
+
81
87
  # Apply custom plotting parameters if provided
82
88
  if plot_params:
83
89
  plt.rcParams.update(plot_params)
84
90
 
85
- # Ensure the number of labels matches the number of value sets
86
- assert len(values) == len(labels), "The number of value sets must match the number of labels."
91
+ if values.shape[1] > 1:
92
+ num_plots = values.shape[1] # Number of columns in `values`
93
+ cols = int(np.ceil(np.sqrt(num_plots)))
94
+ rows = int(np.ceil(num_plots / cols))
87
95
 
96
+ fig, axs = plt.subplots(rows, cols, figsize=(cols * 5, rows * 4))
97
+ axs = axs.flatten()
98
+
88
99
  # Create the overlaid histogram
89
- for i, (value_set, label) in enumerate(zip(values, labels)):
90
- plt.hist(value_set, bins=bins, color=COLORS[i % len(COLORS)], edgecolor='black', alpha=0.5, label=label)
91
-
100
+ for i, label in enumerate(np.unique(labels)):
101
+ if values.shape[1] > 1:
102
+ for j, lab in enumerate(np.unique(labels)):
103
+ value_set = values[:, j][label == labels]
104
+ axs[i].hist(value_set, bins=bins, color=COLORS[j % len(COLORS)], edgecolor='black', alpha=0.5, label=lab)
105
+ axs[i].set_xlim([0, 1]) # Fix x-axis range between 0 and 1
106
+ else:
107
+ value_set = values[label == labels]
108
+ plt.hist(value_set, bins=bins, color=COLORS[i % len(COLORS)], edgecolor='black', alpha=0.5, label=label)
109
+ plt.xlim([0, 1]) # Fix x-axis range between 0 and 1
110
+
111
+ if values.shape[1] > 1:
112
+ for i in range(i + 1, len(axs)):
113
+ fig.delaxes(axs[i])
114
+
92
115
  # Add title to the plot if provided
93
116
  if title:
94
- plt.title(title)
117
+ if values.shape[1] > 1:
118
+ for i in range(values.shape[1]):
119
+ axs[i].set_title(f'{title} for class {i+1}')
120
+ else:
121
+ plt.title(title)
95
122
 
96
123
  # Add legend to the plot if enabled
97
124
  if legend:
98
- plt.legend(loc='upper right')
125
+ if values.shape[1] > 1:
126
+ for i in range(values.shape[1]):
127
+ axs[i].legend(loc='upper right')
128
+ else:
129
+ plt.legend(loc='upper right')
99
130
 
100
131
  # Set axis labels
101
- plt.xlabel('Values')
102
- plt.ylabel('Frequency')
132
+ if values.shape[1] > 1:
133
+ for i in range(values.shape[1]):
134
+ axs[i].set_xlabel('Values')
135
+ axs[i].set_ylabel('Frequency')
136
+ else:
137
+ plt.xlabel('Values')
138
+ plt.ylabel('Frequency')
139
+
140
+ # Adjust layout to prevent overlapping
141
+ plt.subplots_adjust(hspace=0.9, wspace=0.4)
142
+ plt.tight_layout()
103
143
 
104
144
  # Save the figure if a path is specified
105
145
  if save_path:
@@ -1,10 +1,12 @@
1
1
  import matplotlib.pyplot as plt
2
+ import matplotlib.colors as mcolors
2
3
  import matplotlib.patches as mpatches
3
4
  import pandas as pd
4
5
  from typing import List, Optional, Dict, Any, Union
5
6
  from pathlib import Path
6
7
 
7
8
  plt.rcParams.update({
9
+ 'lines.markersize': 6,
8
10
  'axes.facecolor': "#F8F8F8",
9
11
  'figure.facecolor': "#F8F8F8",
10
12
  'font.family': 'sans-serif',
@@ -41,6 +43,28 @@ COLORS = [
41
43
 
42
44
  MARKERS = ["o", "s", "^", "D", "p", "*", "+", "x", "H", "1", "2", "3", "4", "|", "_"]
43
45
 
46
+ def adjust_color_saturation(color: str, saturation_factor: float = 5) -> str:
47
+ """
48
+ Adjusts the saturation of a given color.
49
+
50
+ Parameters:
51
+ - color (str): The original color in hexadecimal format.
52
+ - saturation_factor (float): The factor by which to adjust the saturation.
53
+ Values > 1 will increase saturation,
54
+ values < 1 will decrease it. Default is 1.5.
55
+
56
+ Returns:
57
+ - str: The color with adjusted saturation in hexadecimal format.
58
+ """
59
+ # Convert color to HSV (Hue, Saturation, Value)
60
+ h, s, v = mcolors.rgb_to_hsv(mcolors.to_rgb(color))
61
+
62
+ # Adjust saturation
63
+ s = min(1, s * saturation_factor)
64
+
65
+ # Convert back to RGB and then to hex
66
+ return mcolors.to_hex(mcolors.hsv_to_rgb((h, s, v)))
67
+
44
68
 
45
69
 
46
70
  def protocol_boxplot(
@@ -100,6 +124,10 @@ def protocol_boxplot(
100
124
 
101
125
 
102
126
 
127
+
128
+
129
+
130
+
103
131
  def protocol_lineplot(
104
132
  table_protocol: pd.DataFrame,
105
133
  methods: Union[List[str], str, None],
@@ -135,10 +163,16 @@ def protocol_lineplot(
135
163
 
136
164
  # Create plot with custom figsize
137
165
  fig, ax = plt.subplots(figsize=figsize)
138
- for i, (method, marker) in enumerate(zip(methods, MARKERS[:len(methods)])):
166
+ for i, (method, marker) in enumerate(zip(methods, MARKERS[:len(methods)+1])):
139
167
  method_data = table[table['QUANTIFIER'] == method]
140
168
  y_data = real if y == "ALPHA" else method_data[y]
141
- ax.plot(method_data[x], y_data, color=COLORS[i % len(COLORS)], marker=marker, label=method, **plot_params)
169
+ color = adjust_color_saturation(COLORS[i % len(COLORS)]) # Aumenta a saturação das cores
170
+ ax.plot(method_data[x],
171
+ y_data, color=color,
172
+ marker=marker,
173
+ label=method,
174
+ alpha=1.0,
175
+ **plot_params)
142
176
 
143
177
  # Add legend
144
178
  if legend:
@@ -155,3 +189,5 @@ def protocol_lineplot(
155
189
  if save_path:
156
190
  plt.savefig(save_path, bbox_inches='tight')
157
191
  plt.show()
192
+
193
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mlquantify
3
- Version: 0.0.11.1
3
+ Version: 0.0.11.3
4
4
  Summary: Quantification Library
5
5
  Home-page: https://github.com/luizfernandolj/QuantifyML/tree/master
6
6
  Maintainer: Luiz Fernando Luth Junior
@@ -109,6 +109,7 @@ ___
109
109
  - [Model Selection](https://github.com/luizfernandolj/mlquantify/wiki/Model-Selection)
110
110
  - [Evaluation](https://github.com/luizfernandolj/mlquantify/wiki/Evaluation)
111
111
  - [Plotting](https://github.com/luizfernandolj/mlquantify/wiki/Plotting)
112
+ - [Utilities](https://github.com/luizfernandolj/mlquantify/wiki/Utilities)
112
113
 
113
114
 
114
115
  ___
@@ -6,7 +6,7 @@ here = pathlib.Path(__file__).parent.resolve()
6
6
 
7
7
  long_description = (here / 'README.md').read_text(encoding='utf-8')
8
8
 
9
- VERSION = '0.0.11.1'
9
+ VERSION = '0.0.11.3'
10
10
  DESCRIPTION = 'Quantification Library'
11
11
 
12
12
  # Setting up
File without changes