Closed friedrichkrohn closed 9 months ago
For everyone struggling with this too: neurocombat works great for harmonizing non-MRI features
Related to #4 , harmonization fails when providing only one feature to harmonize. Closing this issue (keeping the original issue open).
Note, I was able to run the harmonization successfully with the following code.
import numpy as np
import pandas as pd
from neuroHarmonize import harmonizationLearn
data = pd.read_csv('example.csv', index_col=0)
covars = pd.read_csv('example_site.csv', index_col=0)
# prepare inputs to harmonize ICR
data = np.array(data)
# run harmonization without EB adjustments
model, data_adj = harmonizationLearn(data, covars, eb=False)
You don't want the empirical Bayes adjustments for a harmonization of a single variable (EB is for harmonizing multiple variables, such as regional brain volumes).
Hello,
I think I found a bug at line 182 in harmonizationLearn.py: I am trying to harmonize a one-dimensional variable with one feature per subject and only site as a covariate. When calculating the grand mean, harmonizationLearn expects a two-dimensional B_hat but I only provide one feature per subject leading to a one-dimensional B_hat, which causes an error. Did I maybe code the data wrongly?
I tried to upload example data and a covariate matrix only containing the sites I would like to correct across. Does it work?
example.csv
example_site.csv
Best,
Friedrich