prince icon indicating copy to clipboard operation
prince copied to clipboard

Bug in FAMD transform()

Open luismavs opened this issue 1 year ago • 1 comments

Hi,

I am not able to transform FAMD on "new" data.

Using version 0.13.0.

Please see the following code:

import pandas as pd
from prince import MCA, PCA, FAMD
df = pd.DataFrame({'var1':['c', 'a', 'b','c'], 'var2':['x','y','y','z'],'var2': [0.,10.,30.4,0.]})

famd = FAMD(n_components=2)
famd.fit(df[:3])
print(famd.transform(df[0:3]))
print(famd.transform(df[0:2]))
print(famd.transform(df[3:]))

I get the output:

component         0         1
0         -1.303760 -0.658334
1         -0.335621  0.981047
2          1.639381 -0.322713
component   0   1
0         NaN NaN
1         NaN NaN
component   0   1
3         NaN NaN

So FAMD is able to transform the training data itself, but NOT a selection of rows from it, or a new row.

Thanks!

luismavs avatar Nov 12 '23 17:11 luismavs

Yep that isn't supported yet. I'm aware of the issue.

MaxHalford avatar Nov 12 '23 17:11 MaxHalford