code: def compute_masked_contributions(s_contrib, mask):
      """
      Compute the summed contributions of hidden features.
  
      Parameters
      ----------
      s_contrib: pd.DataFrame
          Matrix with both positive and negative values
      mask: pd.DataFrame
          Matrix with only True or False elements. False elements are the hidden elements.
  
      Returns
      -------
      pd.DataFrame
          Sum of contributions of hidden features.
      """
      colname = ["masked_neg", "masked_pos"]
      hidden_neg = np.sum(
          ma.array(
              s_contrib,
              mask=np.max(np.dstack([mask, (s_contrib > 0)]), axis=2),
          ),
          axis=1,
      )
      hidden_pos = np.sum(
          ma.array(
              s_contrib,
              mask=np.max(np.dstack([mask, (s_contrib < 0)]), axis=2),
          ),
          axis=1,
      )
      hidden_contrib = np.array([hidden_neg, hidden_pos])
      return pd.DataFrame(
          hidden_contrib.T, columns=colname, index=s_contrib.index
      )
  
imports: import numpy
  import numpy.ma
  import pandas
label_desc: Use image node_id 1 for calling a global function with example usage: compute_masked_contributions(s_contrib, mask) and returns: pd