maxfuse.utils.graph_smoothing

maxfuse.utils.graph_smoothing(arr, edges, wt)[source]

For each row of arr, shrink it towards the average of its neighborhood by taking wt*raw_data + (1-wt)*nhbd_avg

Parameters:
  • arr (np.array of shape (n_samples, n_features)) – Data matrix

  • edges (list of length two or three) – Each edge of the graph is (edges[0][i], edges[1][i]) and the weight is edges[2][i] (if exists)

  • wt (float) – Weight for shrinkage

Returns:

denoised_arr (np.array of shape (n_samples, n_features)) – Original array after graph_smoothing