Closed raj-shr-git closed 2 months ago
Hmmm are the imputed values for that second variable (top right in the chart) some constant value? I could see this error coming from trying to get the kernel smoothing parameter for a set of numbers with 0 variance.
I believe you are right, kindly refer to the below screenshot:
I think because of the yellow highlighted imputed values this error is getting generated.
It seems like these 3 records have been considered similar in this iteration thus end up getting the same imputed value. In a bigger dataset, this might not happen because we will be having variability in at least some observations. As I have used only a 50 records dataset that too with only 3 missing observations for this variable might have led to this error. Right?
If that's the case doesn't it should show something like the Dirac-delta function instead of giving an error?
Thanks, well that's definitely a bug - I'll have to make it skip any imputations with 0 variance.
Should be fine in plotnine
Hello,
Hope you are doing well!!
I was working with MiceForest on a toy dataset to understand how it works. And, during that came across "LinAlgError: singular matrix" while generating the plot of the imputed distribution.
Can you please refer to the below details and let me know whether I'm doing something wrong.
Step-1 - Create multiple kernel datasets
kernel = mf.MultipleImputedKernel( data=iris_amp, save_all_iterations=True, datasets=10, mean_match_candidates=5, save_models=True, random_state=41 )
Step-2 - Run the MICE algorithm for 5 iterations on each dataset
kernel.mice(5,verbose=True,max_depth=4)
Step-3 - Imputing the dataset
new_data_imputed = kernel.impute_new_data(new_data)
Step-4 - This will return the 9th dataset
new_completed_data = new_data_imputed.complete_data(9)
Step-5 - Plot the imputed distributions
new_data_imputed.plot_imputed_distributions(wspace=0.5,hspace=0.8)
this results in the below error, however, step-5 works fine if I re-run step-3 & 4 and then try to plot the imputed distributions.
`LinAlgError Traceback (most recent call last)