Skip to content

Commit

Permalink
revisar warning
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Feb 8, 2017
2 parents 93b0f06 + 503c114 commit ed6e37c
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .directory
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
[Dolphin]
<<<<<<< HEAD
Timestamp=2017,2,7,17,30,1
Version=3

[Settings]
HiddenFilesShown=true
=======
Timestamp=2017,2,8,12,4,41
Version=3
>>>>>>> 503c114584bd9cb91d18379b03a6c9f494d8b4fc
6 changes: 4 additions & 2 deletions build/lib.linux-x86_64-2.7/sompy/codebook.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
from sklearn.decomposition import RandomizedPCA
from sklearn.decomposition import PCA# RandomizedPCA (randomizedpca is deprecated)
from .decorators import timeit


Expand Down Expand Up @@ -96,7 +96,9 @@ def pca_linear_initialization(self, data):
tmp_matrix = np.tile(me, (self.nnodes, 1))

# Randomized PCA is scalable
pca = RandomizedPCA(n_components=pca_components)
#pca = RandomizedPCA(n_components=pca_components) # RandomizedPCA is deprecated.
pca = PCA(n_components=pca_components, svd_solver='randomized')

pca.fit(data)
eigvec = pca.components_
eigval = pca.explained_variance_
Expand Down
5 changes: 3 additions & 2 deletions build/lib.linux-x86_64-2.7/sompy/sompy.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
from .neighborhood import NeighborhoodFactory
from .normalization import NormalizatorFactory

#lbugnon
import sompy,ipdb
#

class ComponentNamesError(Exception):
pass
Expand Down Expand Up @@ -244,7 +247,6 @@ def train(self,
radiusin=train_rough_radiusin, radiusfin=train_rough_radiusfin)
self.finetune_train(njob=n_job, shared_memory=shared_memory, trainlen=train_finetune_len,
radiusin=train_finetune_radiusin, radiusfin=train_finetune_radiusfin)

logging.debug(
" --------------------------------------------------------------")
logging.info(" Final quantization error: %f" % np.mean(self._bmu[1]))
Expand Down Expand Up @@ -324,7 +326,6 @@ def _batchtrain(self, trainlen, radiusin, radiusfin, njob=1,
t1 = time()
neighborhood = self.neighborhood.calculate(
self._distance_matrix, radius[i], self.codebook.nnodes)

bmu = self.find_bmu(data, njb=njob)
self.codebook.matrix = self.update_codebook_voronoi(data, bmu,
neighborhood)
Expand Down
15 changes: 10 additions & 5 deletions build/lib.linux-x86_64-2.7/sompy/visualization/mapview.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
class MapView(MatplotView):

def _calculate_figure_params(self, som, which_dim, col_sz):
codebook = som._normalizer.denormalize_by(som.data_raw,
som.codebook.matrix)

# add this to avoid error when normalization is not used
if som._normalizer:
codebook = som._normalizer.denormalize_by(som.data_raw, som.codebook.matrix)
else:
codebook = som.codebook.matrix

indtoshow, sV, sH = None, None, None

Expand Down Expand Up @@ -139,7 +143,6 @@ def show(self, som, what='codebook', which_dim='all', cmap=None,
plt.title(compname[0][ind])
font = {'size': self.text_size}
plt.rc('font', **font)

if what == 'cluster':
try:
codebook = getattr(som, 'cluster_labels')
Expand All @@ -160,7 +163,9 @@ def show(self, som, what='codebook', which_dim='all', cmap=None,

plt.subplots_adjust(hspace=h, wspace=w)


plt.show()


class View1D(MapView):

def show(self, som, what='codebook', which_dim='all', cmap=None,
Expand All @@ -178,4 +183,4 @@ def show(self, som, what='codebook', which_dim='all', cmap=None,
mp = codebook[:, ind]
plt.plot(mp, '-k', linewidth=0.8)

plt.show()
#plt.show()
5 changes: 3 additions & 2 deletions build/lib/sompy/sompy.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
from .neighborhood import NeighborhoodFactory
from .normalization import NormalizatorFactory

#lbugnon
import sompy,ipdb
#

class ComponentNamesError(Exception):
pass
Expand Down Expand Up @@ -244,7 +247,6 @@ def train(self,
radiusin=train_rough_radiusin, radiusfin=train_rough_radiusfin)
self.finetune_train(njob=n_job, shared_memory=shared_memory, trainlen=train_finetune_len,
radiusin=train_finetune_radiusin, radiusfin=train_finetune_radiusfin)

logging.debug(
" --------------------------------------------------------------")
logging.info(" Final quantization error: %f" % np.mean(self._bmu[1]))
Expand Down Expand Up @@ -324,7 +326,6 @@ def _batchtrain(self, trainlen, radiusin, radiusfin, njob=1,
t1 = time()
neighborhood = self.neighborhood.calculate(
self._distance_matrix, radius[i], self.codebook.nnodes)

bmu = self.find_bmu(data, njb=njob)
self.codebook.matrix = self.update_codebook_voronoi(data, bmu,
neighborhood)
Expand Down
5 changes: 3 additions & 2 deletions build/lib/sompy/visualization/mapview.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ def show(self, som, what='codebook', which_dim='all', cmap=None,
plt.title(compname[0][ind])
font = {'size': self.text_size}
plt.rc('font', **font)
plt.show()
if what == 'cluster':
try:
codebook = getattr(som, 'cluster_labels')
Expand All @@ -163,6 +162,8 @@ def show(self, som, what='codebook', which_dim='all', cmap=None,
self._set_axis(ax, msz0, msz1)

plt.subplots_adjust(hspace=h, wspace=w)

plt.show()


class View1D(MapView):
Expand All @@ -182,4 +183,4 @@ def show(self, som, what='codebook', which_dim='all', cmap=None,
mp = codebook[:, ind]
plt.plot(mp, '-k', linewidth=0.8)

plt.show()
#plt.show()
Binary file modified dist/SOMPY-1.0-py2.7.egg
Binary file not shown.
Binary file modified dist/SOMPY-1.0-py3.5.egg
Binary file not shown.
3 changes: 2 additions & 1 deletion sompy/sompy.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,9 @@ def _batchtrain(self, trainlen, radiusin, radiusfin, njob=1,
self.codebook.matrix = self.update_codebook_voronoi(data, bmu,
neighborhood)


qerror = (i + 1, round(time() - t1, 3),
np.mean(np.sqrt(bmu[1] + fixed_euclidean_x2)))
np.mean(np.sqrt(bmu[1] + fixed_euclidean_x2))) #lbugnon: ojo aca me tiró un warning, revisar (commit sinc: 965666d3d4d93bcf48e8cef6ea2c41a018c1cb83 )
logging.info(
" epoch: %d ---> elapsed time: %f, quantization error: %f\n" %
qerror)
Expand Down

0 comments on commit ed6e37c

Please sign in to comment.