Skip to content

Distribution of processing

Calculates how much the function is distributed accross the system, with values close to 0 means more localized functions and values near 1 means most elements are fairly involved in producing the outcome. Remember, this value will be low if many units have near zero shapley values while a few has either positive or negative contributions. So, negative contributions still count as involvment in the process.

read more here

Aharonov, R., Segev, L., Meilijson, I., & Ruppin, E. 2003. Localization of function via lesion analysis. Neural Computation.

and here

Saggie-Wexler, Keren, Alon Keinan, and Eytan Ruppin. 2006. Neural Processing of Counting in Evolved Spiking and McCulloch-Pitts Agents. Artificial Life.

Parameters:

Name Type Description Default
shapley_vector DataFrame

Shapley values of the system, not the shapley table tho, shapley values themselves, i.e., averaged over samples so each element has one shapley value.

required

Returns:

Type Description
float64

np.float64: distribution of processing!

Source code in msapy/utils.py
@typechecked
def distribution_of_processing(*, shapley_vector: pd.Series) -> np.float64:
    """
    Calculates how much the function is distributed accross the system, with values close to 0 means more localized
    functions and values near 1 means most elements are fairly involved in producing the outcome. Remember, this value
    will be low if many units have near zero shapley values while a few has either positive or negative contributions.
    So, negative contributions still count as involvment in the process.

    read more here:
        Aharonov, R., Segev, L., Meilijson, I., & Ruppin, E. 2003.
        Localization of function via lesion analysis.
        Neural Computation.

    and here:
        Saggie-Wexler, Keren, Alon Keinan, and Eytan Ruppin. 2006.
        Neural Processing of Counting in Evolved Spiking and McCulloch-Pitts Agents.
        Artificial Life.

    Args:
        shapley_vector (pd.DataFrame):
            Shapley values of the system, not the shapley table tho, shapley values themselves, i.e., averaged over
            samples so each element has one shapley value.

    returns:
        np.float64: distribution of processing!
    """
    normalized = shapley_vector / shapley_vector.abs().sum()  # L1 norm
    d = 1 - normalized.std(ddof=0) / np.sqrt((len(normalized) - 1) / len(normalized) ** 2)
    return d