Labo-Lacourse / StepMixR

R interface to python package StepMix
1 stars 0 forks source link

NA or NaN not being accepted #5

Open follhim opened 1 month ago

follhim commented 1 month ago

Hello, When I came across this package, I was SUPER excited because this has everything I was looking for and more! FIML, 3-step for covariates, and even BCH!

However I'm running into a problem:

Error in py_call_impl(callable, call_args$unnamed, call_args$named) : 
  ValueError: Input X contains NaN.
StepMix does not accept missing values encoded as NaN natively. For supervised learning, you might want to consider sklearn.ensemble.HistGradientBoostingClassifier and Regressor which accept missing values encoded as NaNs natively. Alternatively, it is possible to preprocess the data, for instance by using an imputer transformer in a pipeline or drop samples with missing values. See https://scikit-learn.org/stable/modules/impute.html You can find a list of all estimators that handle NaN values at the following page: https://scikit-learn.org/stable/modules/impute.html#estimators-that-handle-nan-values

Essentially, it's not happy that there is NaN, however I don't understand how to fix this. In your Notebook it simply works, but not for me.

Would greatly appreciate help on this matter!

giguerch commented 1 month ago

Hi Follhim, Do you have the latest version of stepmix (on the python side), some bugs were corrected in the last months? If you can provide a simple example you can share where stepmixr doesn't work, I can try to help you. Regards, Charles-Édouard