Skip to content

Commit d59fbff

Browse files
committed
minor updates to final project description
1 parent b0a0693 commit d59fbff

File tree

1 file changed

+31
-19
lines changed

1 file changed

+31
-19
lines changed

09-final-project/final-project-nn-emulator-description.md

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
**ASTR 596: Modeling the Universe**
44
**Instructor:** Dr. Anna Rosen
55
**Due:** Thursday, December 18, 2025, 11:59 PM
6-
**AI Policy:** Phase 3 (Professional integrationuse AI tools as a working scientist would)
6+
**AI Policy:** Phase 3 (Professional integrationuse AI tools as a working scientist would, but all code must be your own)
77

88
:::{admonition} No Late Submissions
99
:class: warning
@@ -17,13 +17,15 @@ Final projects cannot be accepted after the deadline. This is a hard cutoff due
1717
**What you're building**: A neural network that predicts N-body simulation outcomes, then using it for Bayesian inference.
1818

1919
**The pipeline**:
20-
1. Run 80–100 N-body simulations with varied initial conditions $(Q_0, a)$
20+
21+
1. Run 100 N-body simulations with varied initial conditions $(Q_0, a)$
2122
2. Train a neural network to predict summary statistics $(f_{\rm bound}, \sigma_v, r_h)$
22-
3. Use the fast emulator inside NumPyro to infer what initial conditions produced a given outcome
23+
3. Use the fast emulator inside `NumPyro` to infer what initial conditions produced a given outcome
2324

2425
**Packages you'll learn**: Equinox (NNs), Optax (optimization), NumPyro (probabilistic programming)
2526

2627
**Time**: ~2.5 weeks | **Deliverables**: Code package + research memo
28+
*Note*: You do not need to submit a growth memo for this final project. Instead, you will submit a growth synthesis reflection separately.
2729

2830
---
2931

@@ -62,27 +64,33 @@ Given the final state of a star cluster—its bound mass fraction, velocity disp
6264
This project synthesizes everything:
6365

6466
**Module 1 — Statistical Foundations:**
67+
6568
- Training data as samples from parameter space
6669
- Summary statistics compress high-dimensional simulation outputs into meaningful numbers
6770

6871
**Module 3 — Stellar Dynamics:**
69-
- The virial theorem: $2K + W = 0$ at equilibrium (where $W < 0$ is gravitational potential energy)
70-
- Virial ratio $Q = 2K/|W|$ characterizes dynamical state
71-
- Relaxation, mass segregation, and cluster evolution
72+
73+
- The virial theorem: $2K + W = 0$ at equilibrium (where $W < 0$ is gravitational potential energy and $K$ is kinetic energy).
74+
- Virial ratio $Q = 2K/|W|$ characterizes dynamical state.
75+
- Relaxation, mass segregation, and cluster evolution.
7276

7377
**Module 5 — Bayesian Inference:**
78+
7479
- Inverse problems: observations → parameters
7580
- You built MCMC/HMC from scratch; now you'll use NumPyro's production implementation
7681

7782
**Module 6 — JAX:**
83+
7884
- Automatic differentiation enables gradient-based optimization
7985
- JIT compilation makes emulator evaluation fast enough for inference
8086

8187
**Module 7 — Machine Learning:**
88+
8289
- Neural networks as universal function approximators
8390
- Training via gradient descent with Optax
8491

85-
**Projects 2 & 5:**
92+
**Connection to Projects 2 & 5:**
93+
8694
- Your N-body code generates the ground truth
8795
- Your JAX package provides the infrastructure
8896

@@ -94,11 +102,11 @@ You'll learn three professional JAX packages:
94102

95103
| Package | Purpose | Documentation |
96104
|---------|---------|---------------|
97-
| **Equinox** | Neural networks as PyTrees | https://docs.kidger.site/equinox/ |
98-
| **Optax** | Gradient-based optimization | https://optax.readthedocs.io/ |
99-
| **NumPyro** | Probabilistic programming | https://num.pyro.ai/ |
105+
| **Equinox** | Neural networks as PyTrees | <https://docs.kidger.site/equinox/> |
106+
| **Optax** | Gradient-based optimization | <https://optax.readthedocs.io/> |
107+
| **NumPyro** | Probabilistic programming | <https://num.pyro.ai/> |
100108

101-
All three follow JAX conventionspure functions, explicit state, composable transformations. **Read the "Getting Started" tutorials for each.** Learning new tools from documentation is a core professional skill.
109+
All three follow JAX conventions: pure functions, explicit state, composable transformations. **Read the "Getting Started" tutorials for each.** Learning new tools from documentation is a core professional skill.
102110

103111
---
104112

@@ -112,10 +120,11 @@ Train a neural network to predict **summary statistics** of N-body simulations a
112120

113121
| Parameter | Symbol | Definition | Range |
114122
|-----------|--------|------------|-------|
115-
| Initial virial ratio | $Q_0$ | $Q = \dfrac{2K}{|W|}$ | 0.5 – 1.5 |
123+
| Initial virial ratio | $Q_0$ | $Q = \tfrac{2K}{|W|}$ | 0.5 – 1.5 |
116124
| Plummer scale radius | $a$ | Sets initial concentration | 50 – 200 AU |
117125

118126
The virial ratio characterizes the dynamical state:
127+
119128
- $Q < 1$: Subvirial ("cold")—system will collapse
120129
- $Q = 1$: Virial equilibrium
121130
- $Q > 1$: Supervirial ("hot")—system will expand and dissolve
@@ -139,7 +148,7 @@ These are fundamental diagnostics of stellar dynamics:
139148
- $\sigma_v$ connects to total energy via the virial theorem
140149
- $r_h$ characterizes spatial structure and concentration
141150

142-
Together they encode the dynamical state. An emulator that predicts these accurately has learned real physicsnot just interpolation.
151+
Together they encode the dynamical state. An emulator that predicts these accurately has learned real physics, not just interpolation.
143152
:::
144153

145154
### 1.2 Fixed Simulation Parameters
@@ -150,7 +159,7 @@ Hold these constant across all training runs:
150159
|-----------|-------|-----------|
151160
| $N$ | 200 | Large enough for dynamics, fast enough to generate many runs |
152161
| IMF | Kroupa | Realistic mass spectrum enables mass segregation, preferential ejection |
153-
| Integrator | Leapfrog | Symplecticyour Project 2/5 code |
162+
| Integrator | Leapfrog | Symplectic (your Project 2/5 code) |
154163
| Timestep | Constant $\Delta t$ | Required for symplectic structure (see below) |
155164
| Softening | $\epsilon \sim 0.1 \times a / N^{1/3}$ | ~10% of mean interparticle spacing |
156165

@@ -168,9 +177,10 @@ where $R$ is a characteristic radius (use your Plummer scale radius $a$) and $\s
168177

169178
$$t_{\rm cross} \sim \sqrt{\frac{a^3}{GM}}$$
170179

171-
This is essentially the dynamical timethe timescale over which gravitational dynamics operate. The scaling $t_{\rm cross} \propto a^{3/2} M^{-1/2}$ is what matters; compute it from your initial conditions.
180+
This is essentially the dynamical time: the timescale over which gravitational dynamics operate. The scaling $t_{\rm cross} \propto a^{3/2} M^{-1/2}$ is what matters; compute it from your initial conditions.
172181

173182
After $\sim 10 \, t_{\rm cross}$:
183+
174184
- Subvirial systems ($Q < 1$) have collapsed and re-virialized
175185
- Systems near equilibrium ($Q \approx 1$) remain bound with modest evolution
176186
- Supervirial systems ($Q > 1$) have expanded, with unbound stars escaping
@@ -205,7 +215,7 @@ If you see secular drift or much larger oscillations, reduce $\Delta t$ by a fac
205215

206216
When training an emulator, the design of your training set matters. You need samples that **cover the parameter space efficiently**—not clustered in one region, not leaving gaps where the emulator must extrapolate blindly.
207217

208-
**Why not uniform random sampling?**
218+
**Why not uniform random sampling?**
209219

210220
Random samples from a uniform distribution tend to clump and leave holes, especially in higher dimensions. With only 100 samples in 2D, random sampling might accidentally cluster points in one corner, leaving another corner with no training data. Your emulator would perform poorly there.
211221

@@ -218,6 +228,7 @@ Random samples from a uniform distribution tend to clump and leave holes, especi
218228
The result: every "row" and "column" of parameter space contains exactly one sample. No clumping, no gaps, guaranteed coverage.
219229

220230
For 2D with $N = 100$ samples:
231+
221232
- Divide $Q_0 \in [0.5, 1.5]$ into 100 bins of width 0.01
222233
- Divide $a \in [50, 200]$ into 100 bins of width 1.5 AU
223234
- Each bin in $Q_0$ gets exactly one sample; same for $a$
@@ -228,8 +239,9 @@ LHS is standard practice for computer experiments and surrogate modeling. It pro
228239
**Implementation**: `scipy.stats.qmc.LatinHypercube`
229240

230241
**Dataset sizes**:
231-
- Training set: 80–100 simulations
232-
- Test set: ~20 simulations (held out—never used in training)
242+
243+
- Training set: 100 simulations
244+
- Test set: 20 simulations (held out — never used in training)
233245

234246
:::{admonition} Practical Tip
235247
:class: tip
@@ -250,7 +262,7 @@ $$f_{\rm bound} = \frac{\sum_{i \in \text{bound}} m_i}{\sum_i m_i}$$
250262
**Velocity dispersion** (mass-weighted RMS speed in the COM frame, bound particles only):
251263
$$\sigma_v^2 = \frac{\sum_{i \in \text{bound}} m_i \, |\mathbf{v}_i - \mathbf{v}_{\rm COM}|^2}{\sum_{i \in \text{bound}} m_i}$$
252264

253-
Note: First compute $\mathbf{v}_{\rm COM}$ for the bound population, then compute $\sigma_v$ using velocities relative to that COM. This removes bulk motion and isolates the internal velocity dispersion.
265+
*Note:* First compute $\mathbf{v}_{\rm COM}$ for the bound population, then compute $\sigma_v$ using velocities relative to that COM. This removes bulk motion and isolates the internal velocity dispersion.
254266

255267
**Half-mass radius**: Sort bound particles by distance from the center of mass. Find the radius $r_h$ enclosing half of the *bound* mass (i.e., the radius within which the cumulative bound mass equals $\frac{1}{2}\sum_{i \in \text{bound}} m_i$).
256268

0 commit comments

Comments
 (0)