TINTOlib 1.3.0__tar.gz → 1.3.1__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 (31) hide show
  1. {tintolib-1.3.0 → tintolib-1.3.1}/PKG-INFO +3 -3
  2. {tintolib-1.3.0 → tintolib-1.3.1}/README.md +1 -1
  3. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/clusters.py +71 -40
  4. {tintolib-1.3.0 → tintolib-1.3.1}/pyproject.toml +1 -1
  5. {tintolib-1.3.0 → tintolib-1.3.1}/.gitignore +0 -0
  6. {tintolib-1.3.0 → tintolib-1.3.1}/LICENSE +0 -0
  7. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/__init__.py +0 -0
  8. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/abstractImageMethod.py +0 -0
  9. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/barGraph.py +0 -0
  10. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/base.py +0 -0
  11. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/bie.py +0 -0
  12. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/combination.py +0 -0
  13. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/deepInsight.py +0 -0
  14. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/distanceMatrix.py +0 -0
  15. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/featureWrap.py +0 -0
  16. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/fotomics.py +0 -0
  17. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/igtd.py +0 -0
  18. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/mappingMethod.py +0 -0
  19. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/paramImageMethod.py +0 -0
  20. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/refined.py +0 -0
  21. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/supertml.py +0 -0
  22. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/tinto.py +0 -0
  23. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/utils/CustomTransformer.py +0 -0
  24. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/utils/LogScaler.py +0 -0
  25. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/utils/Toolbox.py +0 -0
  26. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/utils/assigner.py +0 -0
  27. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/utils/config.py +0 -0
  28. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/utils/constants.py +0 -0
  29. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/utils/geometry.py +0 -0
  30. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/utils/mpiHill_UF.py +0 -0
  31. {tintolib-1.3.0 → tintolib-1.3.1}/TINTOlib/utils/paraHill.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: TINTOlib
3
- Version: 1.3.0
3
+ Version: 1.3.1
4
4
  Summary: Converting tabular data into images
5
5
  Project-URL: Homepage, https://github.com/oeg-upm/TINTOlib
6
6
  Project-URL: Documentation, https://tintolib.readthedocs.io/
@@ -368,7 +368,7 @@ TINTOlib includes a variety of methods for generating synthetic images. Below is
368
368
  | [BIE](https://ieeexplore.ieee.org/document/10278393) | `BIE()` | `problem` `transformer` `verbose` `precision` `zoom` |
369
369
  | [Fotomics](https://www.biorxiv.org/content/10.1101/2022.07.08.499309v2) | `Fotomic()` | `image_dim` `problem` `transformer` `verbose` `outliers` `min_percentile` `max_percentile` `outliers_treatment` `assignment_method` `relocate` `algorithm_opt` `group_method` `zoom` `format` `cmap` `random_seed` |
370
370
  | [DeepInsight](https://www.nature.com/articles/s41598-019-47765-6) | `DeepInsight()` | `image_dim` `problem` `transformer` `verbose` `assignment_method` `relocate` `algorithm_opt` `group_method` `zoom` `format` `cmap` `random_seed` |
371
- | Clusters | `Clusters()` | `problem` `transformer` `verbose` `algorithm` `n_clusters` `random_seed` `n_init` `max_iter` `algorithmMethod` `covariance_type` `ensamMethod` `bandwidth` `kernel` `metric` `RBFKmeans` `zoom` |
371
+ | Clusters | `Clusters()` | `problem` `transformer` `verbose` `algorithm` `n_clusters` `random_seed` `n_init` `max_iter` `algorithmMethod` `covariance_type` `ensamMethod` `bandwidth` `kernel` `metric` `RBFMethod` `zoom` |
372
372
 
373
373
  ---
374
374
 
@@ -126,7 +126,7 @@ TINTOlib includes a variety of methods for generating synthetic images. Below is
126
126
  | [BIE](https://ieeexplore.ieee.org/document/10278393) | `BIE()` | `problem` `transformer` `verbose` `precision` `zoom` |
127
127
  | [Fotomics](https://www.biorxiv.org/content/10.1101/2022.07.08.499309v2) | `Fotomic()` | `image_dim` `problem` `transformer` `verbose` `outliers` `min_percentile` `max_percentile` `outliers_treatment` `assignment_method` `relocate` `algorithm_opt` `group_method` `zoom` `format` `cmap` `random_seed` |
128
128
  | [DeepInsight](https://www.nature.com/articles/s41598-019-47765-6) | `DeepInsight()` | `image_dim` `problem` `transformer` `verbose` `assignment_method` `relocate` `algorithm_opt` `group_method` `zoom` `format` `cmap` `random_seed` |
129
- | Clusters | `Clusters()` | `problem` `transformer` `verbose` `algorithm` `n_clusters` `random_seed` `n_init` `max_iter` `algorithmMethod` `covariance_type` `ensamMethod` `bandwidth` `kernel` `metric` `RBFKmeans` `zoom` |
129
+ | Clusters | `Clusters()` | `problem` `transformer` `verbose` `algorithm` `n_clusters` `random_seed` `n_init` `max_iter` `algorithmMethod` `covariance_type` `ensamMethod` `bandwidth` `kernel` `metric` `RBFMethod` `zoom` |
130
130
 
131
131
  ---
132
132
 
@@ -102,8 +102,8 @@ class Clusters(AbstractImageMethod):
102
102
  - For 'kmedoids' and 'kde' : ['euclidean', 'manhattan', 'chebyshev'].
103
103
  - For 'aggloKNN' : ['euclidean', 'manhattan', 'cosine'].
104
104
  - For 'mixMethod' : ['euclidean', 'manhattan']
105
- RBFKmeans: boolean, optional
106
- If the k-means algorithm is used, we can choose whether the image is formed using the distances from the instances to each of the clusters, or by transforming these distances based on RBF. If this parameter is True, the conversion will be applied; if it is False, it will not be applied.
105
+ RBFMethod: boolean, optional
106
+ If the k-means or k-medoids algorithms is used, we can choose whether the image is formed using the distances from the instances to each of the clusters, or by transforming these distances based on RBF. If this parameter is True, the conversion will be applied; if it is False, it will not be applied.
107
107
 
108
108
  Default False.
109
109
  """
@@ -126,7 +126,9 @@ class Clusters(AbstractImageMethod):
126
126
  KERNEL_TYPES={'gaussian', 'tophat', 'epanechnikov', 'exponential', 'linear', 'cosine'}
127
127
  METRICS_TYPES = {'euclidean', 'manhattan', 'chebyshev'}
128
128
  default_metric='euclidean'
129
- default_RBFKmeans = False
129
+ default_RBFMethod = False
130
+ sigma = None
131
+ sigmaArray = [0,0,0]
130
132
 
131
133
  def __init__(
132
134
  self,
@@ -144,16 +146,16 @@ class Clusters(AbstractImageMethod):
144
146
  bandwidth = None,
145
147
  kernel = None,
146
148
  metric = None,
147
- RBFKmeans = None
149
+ RBFMethod = None
148
150
 
149
151
  ):
150
152
 
151
- # kmeans
153
+ # kmeans
152
154
  # --------------------------------------------------
153
155
  if algorithm == 'kmeans' and (covariance_type or ensamMethod or bandwidth or kernel or metric):
154
156
  raise ValueError(
155
157
  f"Incorrect hyperparameters for the algorithm: '{algorithm}'. "
156
- f"The accepted hyperparameters for this algorithm are: n_clusters, random_seed, n_init, max_iter, algorithmMethod and RBFKmeans."
158
+ f"The accepted hyperparameters for this algorithm are: n_clusters, random_seed, n_init, max_iter, algorithmMethod and RBFMethod."
157
159
  )
158
160
  else:
159
161
  if algorithm == 'kmeans':
@@ -167,13 +169,13 @@ class Clusters(AbstractImageMethod):
167
169
  max_iter = self.default_max_iter
168
170
  if algorithmMethod is None:
169
171
  algorithmMethod = self.default_algorithmMethod
170
- if RBFKmeans is None:
171
- RBFKmeans = self.default_RBFKmeans
172
+ if RBFMethod is None:
173
+ RBFMethod = self.default_RBFMethod
172
174
  # --------------------------------------------------
173
175
 
174
176
  # gaussianMix
175
177
  # --------------------------------------------------
176
- if algorithm == 'gaussianMix' and (algorithmMethod or ensamMethod or bandwidth or kernel or metric or RBFKmeans):
178
+ if algorithm == 'gaussianMix' and (algorithmMethod or ensamMethod or bandwidth or kernel or metric or RBFMethod):
177
179
  raise ValueError(
178
180
  f"Incorrect hyperparameters for the algorithm: '{algorithm}'. "
179
181
  f"The accepted hyperparameters for this algorithm are: n_clusters, random_seed, n_init, max_iter and covariance_type."
@@ -194,7 +196,7 @@ class Clusters(AbstractImageMethod):
194
196
 
195
197
  # aggloKNN
196
198
  # --------------------------------------------------
197
- if algorithm == 'aggloKNN' and (covariance_type or ensamMethod or bandwidth or kernel or random_seed or n_init or max_iter or algorithmMethod or RBFKmeans):
199
+ if algorithm == 'aggloKNN' and (covariance_type or ensamMethod or bandwidth or kernel or random_seed or n_init or max_iter or algorithmMethod or RBFMethod):
198
200
  raise ValueError(
199
201
  f"Incorrect hyperparameters for the algorithm: '{algorithm}'. "
200
202
  f"The accepted hyperparameters for this algorithm are: n_clusters and metric."
@@ -209,7 +211,7 @@ class Clusters(AbstractImageMethod):
209
211
 
210
212
  # kde
211
213
  # --------------------------------------------------
212
- if algorithm == 'kde' and (n_clusters or covariance_type or ensamMethod or random_seed or n_init or max_iter or algorithmMethod or RBFKmeans):
214
+ if algorithm == 'kde' and (n_clusters or covariance_type or ensamMethod or random_seed or n_init or max_iter or algorithmMethod or RBFMethod):
213
215
  raise ValueError(
214
216
  f"Incorrect hyperparameters for the algorithm: '{algorithm}'. "
215
217
  f"The accepted hyperparameters for this algorithm are: metric, kernel and bandwidth."
@@ -226,10 +228,10 @@ class Clusters(AbstractImageMethod):
226
228
 
227
229
  # kmedoids
228
230
  # --------------------------------------------------
229
- if algorithm == 'kmedoids' and (covariance_type or ensamMethod or n_init or algorithmMethod or RBFKmeans or kernel or bandwidth):
231
+ if algorithm == 'kmedoids' and (covariance_type or ensamMethod or n_init or algorithmMethod or kernel or bandwidth):
230
232
  raise ValueError(
231
233
  f"Incorrect hyperparameters for the algorithm: '{algorithm}'. "
232
- f"The accepted hyperparameters for this algorithm are: metric, n_clusters, max_iter and random_seed."
234
+ f"The accepted hyperparameters for this algorithm are: metric, n_clusters, max_iter, RBFMethod and random_seed."
233
235
  )
234
236
  else:
235
237
  if algorithm == 'kmedoids':
@@ -241,11 +243,13 @@ class Clusters(AbstractImageMethod):
241
243
  random_seed = self.default_random_seed
242
244
  if metric is None:
243
245
  metric = self.default_metric
246
+ if RBFMethod is None:
247
+ RBFMethod = self.default_RBFMethod
244
248
  # --------------------------------------------------
245
249
 
246
250
  # factor
247
251
  # --------------------------------------------------
248
- if algorithm == 'factor' and (metric or max_iter or covariance_type or ensamMethod or n_init or algorithmMethod or RBFKmeans or kernel or bandwidth):
252
+ if algorithm == 'factor' and (metric or max_iter or covariance_type or ensamMethod or n_init or algorithmMethod or RBFMethod or kernel or bandwidth):
249
253
  raise ValueError(
250
254
  f"Incorrect hyperparameters for the algorithm: '{algorithm}'. "
251
255
  f"The accepted hyperparameters for this algorithm are: n_clusters and random_seed."
@@ -263,16 +267,16 @@ class Clusters(AbstractImageMethod):
263
267
  if algorithm == 'mixMethod':
264
268
  if ensamMethod is None:
265
269
  ensamMethod = self.default_ensamMethod
266
- hiperAll={'n_clusters','random_seed','n_init','max_iter','algorithmMethod','RBFKmeans','covariance_type','metric','ensamMethod','bandwidth','kernel'}
270
+ hiperAll={'n_clusters','random_seed','n_init','max_iter','algorithmMethod','RBFMethod','covariance_type','metric','ensamMethod','bandwidth','kernel'}
267
271
  hiperOK=set()
268
272
  if 'kmeans' in ensamMethod:
269
- hiperOK.update(['n_clusters','random_seed','n_init','max_iter','algorithmMethod','RBFKmeans'])
273
+ hiperOK.update(['n_clusters','random_seed','n_init','max_iter','algorithmMethod','RBFMethod'])
270
274
  if 'gaussianMix' in ensamMethod:
271
275
  hiperOK.update(['n_clusters','random_seed','n_init','max_iter','covariance_type'])
272
276
  if 'aggloKNN' in ensamMethod:
273
277
  hiperOK.update(['n_clusters','metric'])
274
278
  if 'kmedoids' in ensamMethod:
275
- hiperOK.update(['n_clusters','metric','random_seed','max_iter'])
279
+ hiperOK.update(['n_clusters','metric','random_seed','max_iter','RBFMethod'])
276
280
  if 'factor' in ensamMethod:
277
281
  hiperOK.update(['n_clusters','random_seed'])
278
282
  hiperOK.update(['ensamMethod'])
@@ -299,8 +303,8 @@ class Clusters(AbstractImageMethod):
299
303
  max_iter = self.default_max_iter
300
304
  if algorithmMethod is None:
301
305
  algorithmMethod = self.default_algorithmMethod
302
- if RBFKmeans is None:
303
- RBFKmeans = self.default_RBFKmeans
306
+ if RBFMethod is None:
307
+ RBFMethod = self.default_RBFMethod
304
308
  if 'gaussianMix' in ensamMethod:
305
309
  if n_clusters is None:
306
310
  n_clusters = self.default_n_clusters
@@ -326,6 +330,8 @@ class Clusters(AbstractImageMethod):
326
330
  random_seed = self.default_random_seed
327
331
  if metric is None:
328
332
  metric = self.default_metric
333
+ if RBFMethod is None:
334
+ RBFMethod = self.default_RBFMethod
329
335
  if 'factor' in ensamMethod:
330
336
  if n_clusters is None:
331
337
  n_clusters = self.default_n_clusters
@@ -411,7 +417,7 @@ class Clusters(AbstractImageMethod):
411
417
  if metric=="manhattan":
412
418
  metric="cityblock"
413
419
  self.metric=metric
414
- self.RBFKmeans=RBFKmeans
420
+ self.RBFMethod=RBFMethod
415
421
 
416
422
  def _img_to_file(self, image_matrix, file):
417
423
  img = Image.fromarray(np.uint8(np.squeeze(image_matrix)))
@@ -622,17 +628,17 @@ class Clusters(AbstractImageMethod):
622
628
  if typeProc is None:
623
629
  self.model=kmeans.fit(X)
624
630
  auxX = self.model.transform(X)
625
- if self.RBFKmeans:
626
- sigma = np.mean(auxX)
627
- auxX = np.exp(-(auxX**2)/(2*sigma**2))
631
+ if self.RBFMethod:
632
+ self.sigma = np.mean(auxX)
633
+ auxX = np.exp(-(auxX**2)/(2*self.sigma**2))
628
634
  self.minmax=MinMaxScaler(feature_range=(0,255))
629
635
  self.minmax=self.minmax.fit(auxX)
630
636
  else:
631
637
  self.modelList.append(kmeans.fit(X))
632
638
  auxX = self.modelList[len(self.modelList)-1].transform(X)
633
- if self.RBFKmeans:
634
- sigma = np.mean(auxX)
635
- auxX = np.exp(-(auxX**2)/(2*sigma**2))
639
+ if self.RBFMethod:
640
+ self.sigma = np.mean(auxX)
641
+ auxX = np.exp(-(auxX**2)/(2*self.sigma**2))
636
642
  self.minmaxList.append(MinMaxScaler(feature_range=(0,255)))
637
643
  self.minmaxList[len(self.minmaxList)-1]=self.minmaxList[len(self.minmaxList)-1].fit(auxX)
638
644
 
@@ -736,7 +742,7 @@ class Clusters(AbstractImageMethod):
736
742
  self.minmaxList.append(MinMaxScaler(feature_range=(0,255)))
737
743
  self.minmaxList[len(self.minmaxList)-1]=self.minmaxList[len(self.minmaxList)-1].fit(auxX)
738
744
 
739
- def __mixMethod(self,X,clustersIni, seedIni):
745
+ def __mixMethod(self,X,clustersIni, seedIni, final = None):
740
746
 
741
747
  """
742
748
  For each position in the ensamMethod hyperparameter list, a model is generated according to the algorithm chain specified at that position.
@@ -746,15 +752,19 @@ class Clusters(AbstractImageMethod):
746
752
  "The number of clusters cannot be greater than the number of features for the factor algorithm."
747
753
  )
748
754
 
749
- for methodIn in self.ensamMethod:
755
+ for (indexLoop,methodIn) in enumerate(self.ensamMethod):
750
756
  if (methodIn=="aggloKNN"):
751
757
  self.__aggloKNN(X,clustersIni,"mix")
752
758
  elif (methodIn=="kmeans"):
753
- self.__kmeans(X,clustersIni,seedIni,"mix")
759
+ self.__kmeans(X,clustersIni,seedIni,"mix")
760
+ if (final=="FINAL") and (self.RBFMethod==True):
761
+ self.sigmaArray[indexLoop]=self.sigma
754
762
  elif (methodIn=="gaussianMix"):
755
763
  self.__gaussianMix(X,clustersIni,seedIni,"mix")
756
764
  elif (methodIn=="kmedoids"):
757
765
  self.__kmedoids(X,clustersIni,seedIni,"mix")
766
+ if (final=="FINAL") and (self.RBFMethod==True):
767
+ self.sigmaArray[indexLoop]=self.sigma
758
768
  elif (methodIn=="factor"):
759
769
  self.__factor(X,clustersIni,seedIni,"mix")
760
770
 
@@ -835,11 +845,17 @@ class Clusters(AbstractImageMethod):
835
845
  if typeProc is None:
836
846
  self.model=X[medoid_indices]
837
847
  auxX = cdist(X, self.model, metric=self.metric)
848
+ if self.RBFMethod:
849
+ self.sigma = np.mean(auxX)
850
+ auxX = np.exp(-(auxX**2)/(2*self.sigma**2))
838
851
  self.minmax=MinMaxScaler(feature_range=(0,255))
839
852
  self.minmax=self.minmax.fit(auxX)
840
853
  else:
841
854
  self.modelList.append(X[medoid_indices])
842
855
  auxX = cdist(X, self.modelList[len(self.modelList)-1], metric=self.metric)
856
+ if self.RBFMethod:
857
+ self.sigma = np.mean(auxX)
858
+ auxX = np.exp(-(auxX**2)/(2*self.sigma**2))
843
859
  self.minmaxList.append(MinMaxScaler(feature_range=(0,255)))
844
860
  self.minmaxList[len(self.minmaxList)-1]=self.minmaxList[len(self.minmaxList)-1].fit(auxX)
845
861
 
@@ -919,7 +935,7 @@ class Clusters(AbstractImageMethod):
919
935
  if method=="kmeans":
920
936
  self.__kmeans(xOpt, K, seed)
921
937
  XEX = self.model.transform(xOpt)
922
- if self.RBFKmeans:
938
+ if self.RBFMethod:
923
939
  sigma = np.mean(XEX)
924
940
  XEX = np.exp(-(XEX**2)/(2*sigma**2))
925
941
  elif method=="gaussianMix":
@@ -931,13 +947,16 @@ class Clusters(AbstractImageMethod):
931
947
  elif method=="kmedoids":
932
948
  self.__kmedoids(xOpt, K, seed)
933
949
  XEX = cdist(xOpt, self.model, metric=self.metric)
950
+ if self.RBFMethod:
951
+ sigma = np.mean(XEX)
952
+ XEX = np.exp(-(XEX**2)/(2*sigma**2))
934
953
  elif method=="mixMethod":
935
954
  self.__mixMethod(xOpt, K, seed)
936
955
  self.predictMix=[]
937
956
  for i,k in enumerate(self.ensamMethod):
938
957
  if k=="kmeans":
939
958
  XEX=self.modelList[i].transform(xOpt)
940
- if self.RBFKmeans:
959
+ if self.RBFMethod:
941
960
  sigma = np.mean(XEX)
942
961
  XEX = np.exp(-(XEX**2)/(2*sigma**2))
943
962
  self.predictMix.append(XEX)
@@ -949,7 +968,11 @@ class Clusters(AbstractImageMethod):
949
968
  xNorm = normalize(xOpt, norm="l2")
950
969
  self.predictMix.append(self.modelList[i].predict_proba(xNorm))
951
970
  elif k=="kmedoids":
952
- self.predictMix.append(cdist(xOpt, self.modelList[i], metric=self.metric))
971
+ XEX = cdist(xOpt, self.modelList[i], metric=self.metric)
972
+ if self.RBFMethod:
973
+ sigma = np.mean(XEX)
974
+ XEX = np.exp(-(XEX**2)/(2*sigma**2))
975
+ self.predictMix.append(XEX)
953
976
  XEX = self.predictMix
954
977
 
955
978
  XEX=self.__xTransforImage(XEX)
@@ -976,6 +999,7 @@ class Clusters(AbstractImageMethod):
976
999
 
977
1000
  def _fitAlg(self, x: pd.DataFrame, y: Union[pd.DataFrame, None]):
978
1001
 
1002
+ self.sigmaArray = [0,0,0]
979
1003
  X = x.values
980
1004
  x=self.scale.fit_transform(X)
981
1005
 
@@ -1010,7 +1034,7 @@ class Clusters(AbstractImageMethod):
1010
1034
  elif (self.algorithm=="kmedoids"):
1011
1035
  self.__kmedoids(x,self.n_clusters,self.random_seed)
1012
1036
  elif (self.algorithm=="mixMethod"):
1013
- self.__mixMethod(x,self.n_clusters,self.random_seed)
1037
+ self.__mixMethod(x,self.n_clusters,self.random_seed,"FINAL")
1014
1038
  elif (self.algorithm=="factor"):
1015
1039
  if self.n_clusters > len(x[0])-1:
1016
1040
  raise ValueError(
@@ -1025,9 +1049,9 @@ class Clusters(AbstractImageMethod):
1025
1049
  x = self.scale.transform(x.to_numpy())
1026
1050
  if (self.algorithm=="kmeans"):
1027
1051
  x = self.model.transform(x)
1028
- if self.RBFKmeans:
1029
- sigma = np.mean(x)
1030
- x = np.exp(-(x**2)/(2*sigma**2))
1052
+ if self.RBFMethod:
1053
+ # sigma = np.mean(x)
1054
+ x = np.exp(-(x**2)/(2*self.sigma**2))
1031
1055
  elif (self.algorithm=="gaussianMix"):
1032
1056
  x = self.model.predict_proba(x)
1033
1057
  elif (self.algorithm=="factor"):
@@ -1064,14 +1088,17 @@ class Clusters(AbstractImageMethod):
1064
1088
  x=kdeData.to_numpy()
1065
1089
  elif (self.algorithm=="kmedoids"):
1066
1090
  x = cdist(x, self.model, metric=self.metric)
1091
+ if self.RBFMethod:
1092
+ # sigma = np.mean(x)
1093
+ x = np.exp(-(x**2)/(2*self.sigma**2))
1067
1094
  elif (self.algorithm=="mixMethod"):
1068
1095
  self.predictMix=[]
1069
1096
  for i,k in enumerate(self.ensamMethod):
1070
1097
  if k=="kmeans":
1071
1098
  xIn=self.modelList[i].transform(x)
1072
- if self.RBFKmeans:
1073
- sigma = np.mean(xIn)
1074
- xIn = np.exp(-(xIn**2)/(2*sigma**2))
1099
+ if self.RBFMethod:
1100
+ # sigma = np.mean(xIn)
1101
+ xIn = np.exp(-(xIn**2)/(2*self.sigmaArray[i]**2))
1075
1102
  self.predictMix.append(xIn)
1076
1103
  elif k=="gaussianMix":
1077
1104
  self.predictMix.append(self.modelList[i].predict_proba(x))
@@ -1081,7 +1108,11 @@ class Clusters(AbstractImageMethod):
1081
1108
  xNorm = normalize(x, norm="l2")
1082
1109
  self.predictMix.append(self.modelList[i].predict_proba(xNorm))
1083
1110
  elif k=="kmedoids":
1084
- self.predictMix.append(cdist(x, self.modelList[i], metric=self.metric))
1111
+ xIn=cdist(x, self.modelList[i], metric=self.metric)
1112
+ if self.RBFMethod:
1113
+ # sigma = np.mean(xIn)
1114
+ xIn = np.exp(-(xIn**2)/(2*self.sigmaArray[i]**2))
1115
+ self.predictMix.append(xIn)
1085
1116
  x = self.predictMix
1086
1117
  if (y is None):
1087
1118
  y = np.zeros(x.shape[0])
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "TINTOlib"
7
- version = "1.3.0"
7
+ version = "1.3.1"
8
8
  authors = [
9
9
  { name="BorjaRei", email="borjareinoso@gmail.com" },
10
10
  { name= "manwestc", email="jcastillo@fi.upm.es"},
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