up
### Problem Set 5 (22.6 - 6.7.08)

#### Update:

As an alternative to the sensory input scheme descibed above you can solve the problem set in the following way: Simply take the x and y position values from your random walk and mix them with some faster functions that also depend on x and y. For example you can take functions like sin(10*x). Then perform linear SFA like in problem set 4. However, if you take this simpler path then it is mandatory to combine this with SOM. So take the random walk x and y output from SFA and train a 2d mesh on it. Visualize how the mesh covers the original room by picking sampling points from the room, process them with SFA, find the nearest SOM node and use this information to color the room according to the corresponding SOM nodes.

In this exercise we want to continue our work with Slow Feature Analysis (SFA) and optionally combine it with Self Organizing Maps (SOM) to build a very simple model for place cells (similar to what has been done in this paper).

- We want to simulate the movement of a mouse and the sensory input it receives. Start by implementing a random walk in a rectangular room. To encode a position in the room use the x and y coordinate. Simulate the movement of a mouse in this room by creating a random path. Implement some kind of inertia, to make the path smoother and more realistic (e.g. by picking random velocity vectors and smoothly interpolating between them). To simplify the problem you can assume that the mouse bounces of walls (e.g. by mirroring the velocity vector when the mouse hits a wall).
- Create some kind of sonsory input based on this random walk. I would suggest to take a 2d array (filled with random data or some kind of pattern) which corresponds to the whole room. To get the sensory input for a given position in the room take a smaller patch of the array. The position of the patch corresponds to the x and y coordinate.
- Use SFA to reduce the dimensionality of the sonsory input. Depending on how well this works you might have to pick a different pattern for the array (e.g. a simple gradient makes this problem trivial in one dimension). You can also try a nonlinear expansion. If you want you can use the MDP library (including the SFA implementation). Ideally the SFA output will consist of the x and y values, but this might be hard to achieve. Try to visualize the SFA outputs by superimposing them on the room (i.e. the color at a certain position encodes the value of one SFA-output).

To finish this problem set you can either try to optimize the quality of the SFA outputs or apply some additional post-processing. For example you can use the SOM algorithm from problem set 2 to map a 2d mesh onto the SFA output. Ideally the mesh should then correspond to the positions in the room. Plot how the mash covers the room by mapping each mesh vertex to a corresponding position in the room. To get the position in of the vertices in the room you can check for which position in the room the SFA output is closest to a given mesh vertex. You can also try a vector quantisation (which is basically SOM without any neighboorhood relations, i.e. only the winning vector is moved).