# How to know what kind of memory is stored in the connection weights?

So, I have seen few pictures re-created by a Neural Network or some other Machine Learning algorithm after it has been trained over a data set.

How, exactly is this done? How are the weights converted back into a picture or a memory which a Neural Net is holding?

A real life example would be when we close our eyes we can easily visualize things we have seen. Based on that we can classify things we see. Now in a Neural Net classification part is easily done, but what about the visualization part? What does the Neural Net see when it closes its eyes? And how to represent it for human understanding?

For example a deep net generated this picture:

There can be many other things generated. But the question is how exactly is this done?

You should use google for this question, it is extremely vague. Some technical documents will give very clear insight into what's happening here.

https://blog.openai.com/generative-models/

http://proceedings.mlr.press/v37/gregor15.pdf

If you really want to understand "what the AI is thinking", well, you may never know. The idea of AI is that it can handle complex data (high degree of dimensionality) and is too complex for Humans to comprehend.

• Actually I was asking how to back calculate in a nn to represent the memory of the object it is classifying... Image is just a specific case – DuttaA Jan 30 '18 at 4:48

A "normal" neural network can give you a distribution of probabilities for categories given some image. (Ex: a picture of a dog might return 50% dog; 30% cat; 10% car; 5% laptop; 5% skeleton).

What we then do, is maximize the probability of a given category by manipulating the image directly. We do this iteratively, until we are satisfied by the result.

For example, one might start with a grey image, tweak some random pixels to improve a specific category probability of the image, save our results, and repeat, until we have an image that responds very well to a given probability.

So to answer your question, the weights aren't directly manipulated to produce the image, though they are implicitly used in the construction.

• I don't get it....As far as I know for simple NN's input is not manipulated? What am i missing? – DuttaA Mar 1 '18 at 5:01
• Yes, for simple NNs the input is not manipulated. However to generate the images such as the one you posted, we alter the image to converge towards a high likelihood for a given class. – k.c. sayz 'k.c sayz' Apr 30 '18 at 2:53