markvanderloo / simputation

Making imputation easy
GNU General Public License v3.0
89 stars 11 forks source link

Use on an image? #6

Closed jennybc closed 7 years ago

jennybc commented 7 years ago

I need to teach imputation soon and am happy to have found this package!

I've been trying to think up a very simple, compelling, and visual example to work through and someone suggested working with an image, where certain pixels are missing.

Have you ever done that (or seen a nice example somewhere)? Even better, using this package?

If not, do you have a hunch whether this will work out nicely? Is it clear to you in advance that this is either a great or terrible idea? Thanks for any wisdom.

markvanderloo commented 7 years ago

Thanks :-).

I have never imputed an image, but it is an interesting idea. This package assumes that variables are columns and cases are rows. Also, missings must be represented as NA. If you can represent the image as one or more columns, (RGB, hex codes) it could work. Perhaps a sequential hotdeck would be suitable. That would amount to imputing the neighboring pixel (which neighbor depending on how the image is unrolled to a vector).

Now that I think of it, if the image is represented as one or more matrices you could stick that in a data.frame , each column containing one matrx. I think that impute_shd() for sequential hot deck would work. Not really what I had in mind when I wrote this package, and I would have to test it but I don't see why it wouldn't work in principle.

markvanderloo commented 7 years ago

Hi Jenny,

Just wandering: what package did you decide to use in the end? this one, or VIM, or something else?

Cheers, Mark

jennybc commented 7 years ago

In the end we ran out of time to treat this topic 😢. I had to choose between this and robust statistics. But I did provide them the link to this package and recommended they try it as soon as they need to impute.

I still think imputing an image would make a really nice visual example. I had thought about using a PNG of one (or more?) emoji and deleting pixels at random vs. in other strategic places ...

Sorry it didn't happen this time 'round.

njtierney commented 7 years ago

Hi @jennybc,

A friend of mine worked on a similar idea of using an image and removing pixels and them imputed them, but he was using Singular Value Decomposition. Might be an interesting read: https://beelzebubjones1.blogspot.com.au/2014/07/a-sprinkling-of-pixel-dust.html