tiepvupsu / DICTOL_python

A Python implementation of well-known dictionary learning methods.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DLSI.test_unit() is failing for me in dictol.demo()

kac53211 opened this issue · comments

I think that N_train (at line 124) in DLSI.test_unit() should be set to 15 and not 5??
(or something greater than 10 for the k = 10 at line 126)
making this change locally fixed it for me


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/DICTOL_python/dictol/DLSI.py", line 137, in test_unit
    clf.fit(Y_train, label_train, iterations=100, verbose=True)
  File "~/DICTOL_python/dictol/DLSI.py", line 34, in fit
    self._initialize()
  File "~/DICTOL_python/dictol/DLSI.py", line 61, in _initialize
    clf.fit(Yc)
  File "~/DICTOL_python/dictol/ODL.py", line 29, in fit
    self.D = utils.pickDfromY(self.Y, Y_range, D_range)
  File "~/DICTOL_python/dictol/utils.py", line 304, in pickDfromY
    D[:, D_range[c]:D_range[c+1]] = Yc[:, np.sort(ids[:kc])]
ValueError: could not broadcast input array from shape (504,5) into shape (504,10)

Good catch! I made the change in the codebase.

Thank you for that!

Thanks!

I think that N_train (at line 124) in DLSI.test_unit() should be set to 15 and not 5??
(or something greater than 10 for the k = 10 at line 126)
making this change locally fixed it for me

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "~/DICTOL_python/dictol/DLSI.py", line 137, in test_unit
    clf.fit(Y_train, label_train, iterations=100, verbose=True)
  File "~/DICTOL_python/dictol/DLSI.py", line 34, in fit
    self._initialize()
  File "~/DICTOL_python/dictol/DLSI.py", line 61, in _initialize
    clf.fit(Yc)
  File "~/DICTOL_python/dictol/ODL.py", line 29, in fit
    self.D = utils.pickDfromY(self.Y, Y_range, D_range)
  File "~/DICTOL_python/dictol/utils.py", line 304, in pickDfromY
    D[:, D_range[c]:D_range[c+1]] = Yc[:, np.sort(ids[:kc])]
ValueError: could not broadcast input array from shape (504,5) into shape (504,10)

I am seeing the same error. In the codebase the k (at line 126) is now 15 and N_train (at line 124) in DLSI.test_unit() is still 5. As suggested above, N_train should be bigger than the k, not the other way around. making this change locally fixed it for me

@Simon-uibk I don't quite understand what you meant.

N_train in L124 is 15 now.
https://github.com/tiepvupsu/DICTOL_python/blob/master/dictol/DLSI.py#L124

@tiepvupsu Thx for the quick reply. It seems as if the version that I installed does not match the version here on GitHub. When running pip install dictol the DLSI.py file still has the "wrong" numbers in it.

@Simon-uibk please clone the repo instead. The pip version is no longer maintained.

https://github.com/tiepvupsu/DICTOL_python#installation