MaxHalford / prince

:crown: Multivariate exploratory data analysis in Python — PCA, CA, MCA, MFA, FAMD, GPA
https://maxhalford.github.io/prince
MIT License
1.27k stars 184 forks source link

FAMD transform ValueError on qualitative data #141

Closed EldadTalShir closed 1 year ago

EldadTalShir commented 1 year ago

Hi all,

FAMD's transform raises a pandas ValueError on qualitative data. To reproduce:

df = pd.DataFrame(data=[['i',1,'n'],['ii',2,'n'],['iii',3,'y']], columns=['a','b','c']) dimred = prince.FAMD(n_components=2,random_state=1,engine='sklearn') fitted = dimred.fit(df) fitted.transform(df)

I have tried using fitted.row_coordinates(df) instead but the results differ from those obtained via transform previously on the same dataset.

Would appreciate any input/advice on this!

MaxHalford commented 1 year ago

Hey @EldadTalShir! Nice one, you caught a bug. I forgot to check FAMD's transform method. I've fixed the issue and added unit tests so this doesn't happen again. You can download the latest version (0.8.3) to get this fix.

Thanks for opening the issue 🙏