#NEWLINE# def bin_to_group_indices( bin_indices , mask ) : #NEWLINE# #INDENT# ' Transforms bin_indices into group indices, skips empty bins\n    :type bin_indices: numpy.array, each element in index of bin this event belongs, shape = [n_samples]\n    :type mask: numpy.array, boolean mask of indices to split into bins, shape = [n_samples]\n    :rtype: list(numpy.array), each element is indices of elements in some bin\n    ' #NEWLINE# assert ( len ( bin_indices ) == len ( mask ) ) , 'Different length' #NEWLINE# bins_id = numpy . unique ( bin_indices ) #NEWLINE# result = list ( ) #NEWLINE# for bin_id in bins_id : #NEWLINE# #INDENT# result . append ( numpy . where ( ( mask & ( bin_indices == bin_id ) ) ) [ 0 ] ) #NEWLINE# #UNINDENT# return result