Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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).

Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion glrm/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from glrm import GLRM
from .glrm import GLRM
2 changes: 1 addition & 1 deletion glrm/convergence.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions glrm/glrm.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion glrm/reg.py
Original file line number Diff line number Diff line change
@@ -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

"""
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
)