Skip to main content

classification

classification(
    U,
    Uhat,
    size=None,
    npc=None,
    metric='correlation',
    reduce_func=np.mean,
)

Movie time point/segment classification accuracy.

Parameters

Name Type Description Default
U (ndarray, shape(nt, nv)) The measured response patterns, often the columns are normalized PCs of the measured data rather than the original voxels/vertices. required
Uhat (ndarray, shape(nt, nv)) The predicted response patterns. required
size int or None The number of time points in each segment. If None, each time point is treated as a segment. None
npc int or None The number of PCs used for classification. If None, all PCs are used. If not None, assuming that U and Uhat are PCs, the first npc PCs are used for classification. None
metric str The metric used for calculating the distance between two segments. See scipy.spatial.distance.cdist for the available metrics. 'correlation'
reduce_func callable or None The function used for reducing the classification accuracy across segments. If None, the raw classification accuracy is returned, where the length of the returned array is equal to the number of segments. np.mean

Returns

Name Type Description
acc float or ndarray The classification accuracy. If reduce_func is None, the returned value is an ndarray of shape (nc,), where nc is the number of segments. Otherwise, the returned value is a float.