#NEWLINE# def filter_nonzero( data , combine = None ) : #NEWLINE# #INDENT# '\n    Filter non-zero features of data according to a certain combining function\n\n    Parameters\n    ----------\n    data : list of matrices\n        List of data matrices, either in sparse format or not.\n        They must have the same number of features (column number).\n    combine : function\n        A function to combine elementwise which features to keep.\n        Default keeps the intersection of each non-zero columns.\n\n    Returns\n    -------\n    indices : ndarray object\n        Indices of the nonzero features.\n    ' #NEWLINE# nz_feats = nonzero_features ( data , combine ) #NEWLINE# return [ combine [ : , nz_feats ] for set in data ]