# Figuring out mapping between two matrices

Imagine I have a 2D matrix, A. I apply some transformation to it, for example: B = A_shifted + A.

Would it be possible to train a CNN to learn back the mapping from B to A? Giving B as example and A as target?

Thanks!

Yes, with some limitations.

CNNs can be used to map images to related images, and that should include many simple matrix transformations. For instance, here is an example of de-blurring OCRed text using a CNN.

Basically, you would train your network with lots of A, B examples, with the input as B and desired output as A.

The limitation is that where you have transformations that are technically irreversible, then the CNN may learn to produce a best "mean" output. The symptom of this will be fuzzy images lacking high frequency components, and matrices which are not representative of the target distribution, but that do solve the transformation (within limits of training accuracy). If you want to improve on that, and produce a more realistic/precise original, then you will probably want to look at adding a generative component - a GAN, VAE/GAN or RBM etc. Note this would not accurately produce the original matrix, but would generate one that both transformed into your given transformed matrix (within some level of accuracy) and was sampled from your input distribution. That is, it could be more of a feasible original than one generated using a simpler CNN architecture.