def nonzero_features(data, combine=None):
 if (combine is None):
  combine = functools.partial(reduce, numpy.logical_and)
 masks = numpy.asarray([subset.sum(axis=0) for subset in data]).squeeze()
 nz_feats = combine(masks).nonzero()[0]
 return nz_feats

def nonzero_features ( data , combine = None ) : if ( combine is None ) : combine = functools . partial ( reduce , numpy . logical_and ) masks = numpy . asarray ( [ subset . sum ( axis = 0 ) for subset in data ] ) . squeeze ( ) nz_feats = combine ( masks ) . nonzero ( ) [ 0 ] return nz_feats
get features for which there are nonzero entries in the data .