mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-05-24 14:15:14 +02:00
[subbarray] logging
This commit is contained in:
parent
83e2df838d
commit
06ee090a50
2 changed files with 10 additions and 6 deletions
|
|
@ -221,9 +221,11 @@ class VarDTCMissingData(LatentFunctionInference):
|
||||||
inan = self._inan
|
inan = self._inan
|
||||||
has_none = True
|
has_none = True
|
||||||
if has_none:
|
if has_none:
|
||||||
|
print "caching missing data slices, this can take several minutes..."
|
||||||
from ...util.subarray_and_sorting import common_subarrays
|
from ...util.subarray_and_sorting import common_subarrays
|
||||||
self._subarray_indices = []
|
self._subarray_indices = []
|
||||||
for v,ind in common_subarrays(inan, 1).iteritems():
|
csa = common_subarrays(inan, 1)
|
||||||
|
for v,ind in csa.iteritems():
|
||||||
if not np.all(v):
|
if not np.all(v):
|
||||||
v = ~np.array(v, dtype=bool)
|
v = ~np.array(v, dtype=bool)
|
||||||
ind = np.array(ind, dtype=int)
|
ind = np.array(ind, dtype=int)
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,8 @@ def common_subarrays(X, axis=0):
|
||||||
assert X.ndim == 2 and axis in (0,1), "Only implemented for 2D arrays"
|
assert X.ndim == 2 and axis in (0,1), "Only implemented for 2D arrays"
|
||||||
subarrays = defaultdict(list)
|
subarrays = defaultdict(list)
|
||||||
cnt = count()
|
cnt = count()
|
||||||
|
if axis == 0: size = X.shape[0]
|
||||||
|
else: size = X.shape[1]
|
||||||
logger = logging.getLogger("common_subarrays")
|
logger = logging.getLogger("common_subarrays")
|
||||||
def accumulate(x, s, c):
|
def accumulate(x, s, c):
|
||||||
logger.debug("creating tuple")
|
logger.debug("creating tuple")
|
||||||
|
|
@ -55,7 +57,7 @@ def common_subarrays(X, axis=0):
|
||||||
logger.debug("tuple done")
|
logger.debug("tuple done")
|
||||||
col = c.next()
|
col = c.next()
|
||||||
iadd(s[t], [col])
|
iadd(s[t], [col])
|
||||||
logger.debug("added col {}".format(col))
|
logger.info("added col {} {:.2%}".format(col, col/float(size)))
|
||||||
return None
|
return None
|
||||||
if axis == 0: [accumulate(x, subarrays, cnt) for x in X]
|
if axis == 0: [accumulate(x, subarrays, cnt) for x in X]
|
||||||
else: [accumulate(x, subarrays, cnt) for x in X.T]
|
else: [accumulate(x, subarrays, cnt) for x in X.T]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue