Unveiling Secrets Of Brain Function With Generative Modeling: Motion Perception In Primates & Cortical Network Organization In Mice