Example #1
0
def segment_packed_cov(segments, width=None):
    # cov over time within each segment
    if width is None:
        width = segments.tag.shape[2]
    n_segments = segments.shape[0]
    packing_matrix = pack_symmatrix_spmat(width)
    cov = custom_cov(segments).reshape((n_segments, width ** 2))
    rval = theano.sparse.structured_dot(cov, packing_matrix)
    if cov.type.broadcastable[0]:
        # sparse matrices have no broadcastable property,
        # so the broadcastable[0] is always False, even when it shouldn't be
        rval = theano.tensor.Rebroadcast((0, True))(rval)
    return rval
Example #2
0
def segment_packed_cov(segments, width=None):
    #cov over time within each segment
    if width is None:
        width = segments.tag.shape[2]
    n_segments = segments.shape[0]
    packing_matrix = pack_symmatrix_spmat(width)
    cov = custom_cov(segments).reshape((n_segments, width**2))
    rval = theano.sparse.structured_dot(cov, packing_matrix)
    if cov.type.broadcastable[0]:
        # sparse matrices have no broadcastable property,
        # so the broadcastable[0] is always False, even when it shouldn't be
        rval = theano.tensor.Rebroadcast((0, True))(rval)
    return rval
Example #3
0
def segment_cov(segments):
    # cov over time within each segment
    n_segments = segments.shape[0]
    width = segments.shape[2]
    return custom_cov(segments).reshape((n_segments, width ** 2))
Example #4
0
def segment_cov(segments):
    #cov over time within each segment
    n_segments = segments.shape[0]
    width = segments.shape[2]
    return custom_cov(segments).reshape((n_segments, width**2))