diff --git a/README.md b/README.md index c220527..5258769 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ ## GLRM +### The original repo is out of maintained from the original author. This repo has several updates, including README, glrm.py, setup.py etc. It still has some instability issue. + GLRM is a python package for exploratory data analysis using Generalized Low Rank Models (GLRMs). @@ -63,8 +65,8 @@ For example, if a 4x4 block of data is missing from the center of A, this corresponds to rows 24-27 and columns 49-50 of submatrix 1, and rows 24-27 and columns 1-2 of submatrix 2. (Python is 0-indexed.) - missing1 = [(23, 48), (23, 49), (24, 48), (24, 49), \ - (25, 48), (25, 49), (26, 48), (26, 49)] + missing1 = [(48, 23), (49, 23), (48, 24), (49, 24), \ + (48, 22), (49, 21), (48, 21), (49, 22)] missing2 = [(23, 0), (23, 1), (24, 0), (24, 1), \ (25, 0), (25, 1), (26, 0), (26, 1)] missing_list = [missing1, missing2] diff --git a/glrm/__init__.py b/glrm/__init__.py index f3a308f..6d26511 100644 --- a/glrm/__init__.py +++ b/glrm/__init__.py @@ -1 +1 @@ -from glrm import GLRM +from .glrm import GLRM diff --git a/glrm/convergence.py b/glrm/convergence.py index 4aba5b6..1956f02 100644 --- a/glrm/convergence.py +++ b/glrm/convergence.py @@ -15,7 +15,7 @@ def d(self): # if converge.d == True: # return True if converged if len(self) < 2: return False if len(self) > self.max_iters: - print "hit max iters for convergence object" + print( "hit max iters for convergence object") return True return abs(self.obj[-1] - self.obj[-2])/self.obj[-2] < self.TOL diff --git a/glrm/glrm.py b/glrm/glrm.py index ac9401c..dc7e48c 100644 --- a/glrm/glrm.py +++ b/glrm/glrm.py @@ -1,4 +1,4 @@ -from convergence import Convergence +from .convergence import Convergence from numpy import sqrt, repeat, tile, hstack, array, zeros, ones, sqrt, diag, asarray, hstack, vstack, split, cumsum from numpy.random import randn from copy import copy @@ -161,7 +161,7 @@ def _initialize_XY(self, B, k, missing_list): def _finalize_XY(self, Xv, Yv): """ Multiply by std, offset by mean """ - m, k = Xv.shape.size + m, k = Xv.size self.X = asarray(hstack((Xv.value, ones((m,1))))) self.Y = [asarray(yj.value)*tile(mask[0,:],(k+1,1)) \ for yj, mask in zip(Yv, self.masks)] diff --git a/glrm/reg.py b/glrm/reg.py index 8b07fdd..ba2c229 100644 --- a/glrm/reg.py +++ b/glrm/reg.py @@ -1,6 +1,6 @@ from numpy.linalg import norm from numpy import sign, Inf -from util import shrinkage +from .util import shrinkage import cvxpy as cp """ diff --git a/setup.py b/setup.py index 296c50d..7bbd28a 100644 --- a/setup.py +++ b/setup.py @@ -10,5 +10,7 @@ url="http://github.com/cehorn/GLRM/", license="MIT", install_requires=[ "numpy >= 1.8", - "scipy >= 0.13"] + "scipy >= 0.13" + "cvxpy >= 0.4.11" + "matplotlib >= 2.1.2"] )