tacco.utils.projection¶
- projection(A, B, metric='bc', deconvolution=False, parallel=True)[source]¶
Calculate pairwise normalized projections of sparse and dense inputs. Depending on the parameters this can be an asymmetric operation: the argument A here is projected on the argument B.
- Parameters:
A – A 2d
ndarray
or a scipy sparse matrix.B – A 2d
ndarray
or a scipy sparse matrix with the same second dimension as A; gives the basis to project on.metric –
A string specifying the metric to use. Available are
’cosine’: Euclidean projection of normalized vectors
’naive’: Euclidean projection of vectors normalized as probability distributions
’bc’: Bhattacharyya coefficient, which is the overlap of two probability distributions.
’bc2’: squared Bhattacharyya coefficient.
deconvolution –
Which method to use for deconvolution of the projections based on the cross-projections of B. If False, no deconvolution is done. Available methods are:
’nnls’: solves nnls to get only non-negative deconvolved projections
’linear’: solves a linear system to disentangle contributions; can result in negative values which makes sense for general vectors and amplitudes, i.e.
parallel – Whether to run the operation in parallel.
- Returns:
A
ndarray
containing the distances.