def velocity_confidence_transition(data, vkey='<STR_LIT>', scale=<NUM_LIT:10>, copy=False):
adata = data.copy() if copy else data<EOL>if vkey not in adata.layers.keys():<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>')<EOL><DEDENT>idx = np.array(adata.var[vkey + '<STR_LIT>'].values, dtype=bool)<EOL>T = transition_matrix(adata, vkey=vkey, scale=scale)<EOL>dX = T.dot(adata.layers['<STR_LIT>'][:, idx]) - adata.layers['<STR_LIT>'][:, idx]<EOL>dX -= dX.mean(<NUM_LIT:1>)[:, None]<EOL>V = adata.layers[vkey][:, idx].copy()<EOL>V -= V.mean(<NUM_LIT:1>)[:, None]<EOL>adata.obs[vkey + '<STR_LIT>'] = prod_sum_var(dX, V) / (norm(dX) * norm(V))<EOL>logg.hint('<STR_LIT>' + vkey + '<STR_LIT>')<EOL>return adata if copy else None<EOL>
Computes confidences of velocity transitions.

    Arguments
    ---------
    data: :class:`~anndata.AnnData`
        Annotated data matrix.
    vkey: `str` (default: `'velocity'`)
        Name of velocity estimates to be used.
    scale: `float` (default: 10)
        Scale parameter of gaussian kernel.
    copy: `bool` (default: `False`)
        Return a copy instead of writing to adata.

    Returns
    -------
    Returns or updates `adata` with the attributes
    velocity_confidence_transition: `.obs`
        Confidence of transition for each cell