def METHOD_NAME(intermediate_layer_output, features_index, threshold):
    """Calculate the mean of each output from each neuron in the layer and
    keep the maximum
    Parameters
    ----------
    intermediate_layer_output : array
       The scaled output of one intermediate layer.
    features_index : integer
       The index of feature in each intermediate layer output array.
       It should be either 0 or -1.
    Returns
    -------
    array
       The maximum output mean of each neuron.
    Notes
    -------
    This method is only used for intermediate output which has only one
    dimension.
    This method is accelerated with numba. Link: http://numba.pydata.org/
    """
    num_layer_neuron = intermediate_layer_output[0].shape[features_index]
    num_input = len(intermediate_layer_output)
    result = np.zeros(shape=(num_input, num_layer_neuron), dtype=np.uint8)
    for input_id in prange(intermediate_layer_output.shape[0]):
        layer_neurons = []
        for layer_neuron_id in prange(num_layer_neuron):
            if features_index == -1:
                neuron_output = intermediate_layer_output[input_id][..., layer_neuron_id]
            else:
                neuron_output = intermediate_layer_output[input_id][layer_neuron_id]
            layer_neurons.append(neuron_output)
        layer_neurons = np.array(layer_neurons)
        k = min(threshold, num_layer_neuron)
        active_idxs = np.argsort(layer_neurons)[-k:]
        for neuron_idx in active_idxs:
            result[input_id][neuron_idx] = 1
    return result