flow-matching-1 / src /metric.py
sabertoaster's picture
Add files using upload-large-folder tool
6247f12 verified
Raw
History Blame Contribute Delete
631 Bytes
import numpy as np
def pearsonr_score(
y_true: np.ndarray, y_pred: np.ndarray, eps: float = 1e-7
) -> np.ndarray:
assert y_true.ndim == y_pred.ndim == 2
y_true = y_true - y_true.mean(axis=0)
y_true = y_true / (np.linalg.norm(y_true, axis=0) + eps)
y_pred = y_pred - y_pred.mean(axis=0)
y_pred = y_pred / (np.linalg.norm(y_pred, axis=0) + eps)
score = (y_true * y_pred).sum(axis=0)
return score
def functional_matrix():
pass # TODO:
def psd_error():
"""Power Spectral Density error metric for comparing temporal dynamics of predicted vs true fmri signals.
TODO:
"""
pass