Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,30 @@ and **Bonferroni** correction for planned comparisons.
NeuroAI-Project13/
├── README.md
├── environment.yml # pinned conda environment
├── requirements.txt # pip dependencies
├── pyproject.toml
├── src/
│ ├── models/ # CTRNN definition + Euler integration
│ ├── models/ # CTRNN definition and architecture
│ ├── training/ # training loop, loss functions, BPTT
│ └── analysis/ # PID / ΦID / MI / Fisher pipelines
├── notebooks/ # exploratory analysis + throwaway/example files
├── results/ # saved model weights/activations, metric outputs
│ ├── tasks/ # NeuroGym task wrappers and stimulus preprocessing
│ └── analysis/ # PID computation, stats, plotting
├── notebooks/ # exploratory scratch analysis + throwaway/example files
├── results/
│ ├── model_weights/ # saved .pt checkpoint files per CTRNN seed
│ │ ├── perceptual/
│ │ └── context/
│ ├── model_activations/ # saved hidden state tensors per CTRNN seed and trial
│ │ ├── perceptual/
│ │ └── context/
│ ├── stimulus_coherences/ # saved coherence arrays per CTRNN seed and trial
│ │ ├── perceptual/
│ │ └── context/
│ └── pid_outputs/ # saved PID atom arrays per CTRNN seed
│ ├── perceptual/
│ └── context/
├── figures/ # final figures
│ ├── learning_curves/ # CTRNN train/test loss and accuracy curves
│ └── pid/ # PID atom plots
└── docs/ # technical note, references
```

Expand Down
File renamed without changes.
Empty file added figures/pid/.gitkeep
Empty file.
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ torch==2.3.1; python_version >= '3.11'
--extra-index-url https://download.pytorch.org/whl/cu121

# Numerics & stats
numpy==1.26.4; python_version >= '3.11'
numpy==2.2.6; python_version >= '3.11'
scipy==1.13.1; python_version >= '3.11'

# Visualization
matplotlib==3.9.2; python_version >= '3.11'
matplotlib==3.10.9; python_version >= '3.11'
seaborn==0.13.2; python_version >= '3.11'

# NeuroGym tasks
Expand Down
Empty file.
Empty file.
38 changes: 37 additions & 1 deletion src/analysis/PID_figures.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,43 @@
plt.gca().spines['top'].set_visible(False)
plt.gca().spines['right'].set_visible(False)
plt.tight_layout()
plt.savefig(f'{dir}pid_bars_{SYSTEM}.png', dpi=300)
# plt.savefig(f'{dir}pid_bars_{SYSTEM}.png', dpi=300)
plt.show()




# Measure Gaussianity of hidden unit activations across all timesteps, for each unit.
import torch
from scipy import stats

h = torch.load(f'{dir}hidden_Sinusoid.pt', weights_only=True).numpy() # (300, 10)
n_units = h.shape[1]
Comment on lines +47 to +52

fig, axes = plt.subplots(2, 5, figsize=(14, 5))
axes = axes.ravel()

for i in range(n_units):
ax = axes[i]
unit_acts = h[:, i] # 300 values across timesteps

# histogram of activations
ax.hist(unit_acts, bins=20, color='#4C78A8', alpha=0.75, density=True, zorder=2)

# overlay best-fit Gaussian for visual comparison
mu, sigma = unit_acts.mean(), unit_acts.std()
x = np.linspace(unit_acts.min(), unit_acts.max(), 200)
ax.plot(x, stats.norm.pdf(x, mu, sigma), color='#E45756', lw=1.8, zorder=3)

# Shapiro-Wilk p-value (tests departure from normality; p<0.05 = non-Gaussian)
_, p = stats.shapiro(unit_acts)
ax.set_title(f'Unit {i+1} p={p:.2f}', fontsize=9)
ax.tick_params(labelsize=7)
ax.spines['top'].set_visible(False)
ax.spines['right'].set_visible(False)

fig.suptitle('Hidden unit activation distributions (blue=data, red=fitted Gaussian)\n'
'Shapiro-Wilk p-value: p>0.05 consistent with Gaussian', fontsize=11)
fig.tight_layout()
# fig.savefig('unit_activations_gaussianity.png', dpi=150, bbox_inches='tight')
plt.show()
58 changes: 0 additions & 58 deletions src/analysis/RNN.py

This file was deleted.

124 changes: 0 additions & 124 deletions src/analysis/compute_pid_sinusoid.py

This file was deleted.

Loading