Логотип Neural Population Analysis Guide

Neural Population Analysis Guide

ОрганизацияПопулярный
NeuroAIHub
neural-population-analysis-guide

Guides dimensionality reduction and latent-variable analysis of neural populations (PCA, GPFA, dPCA)

Обзор

ИздательNeuroAIHub
РепозиторийBrainPilot
Название навыкаneural-population-analysis-guide
Звёзды
1.1K
Форки
74
Файлы в комплекте
2
ЛицензияAGPL-3.0
Ссылки
  • Инструкции в формате Markdown

    Модель загружает файл SKILL.md по мере необходимости, поэтому токены расходуются только при подходящем запросе.

  • Работает с любой большой языковой моделью

    Навыки ИИ — это обычный Markdown, а не код для конкретного поставщика, поэтому они работают с GPT, Claude, Gemini, Grok и локальными моделями.

  • Файлы в комплекте: 2

    Скрипты, шаблоны и справочные материалы, которые модель может читать во время работы. Файлы доступны только для чтения и никогда не выполняются.

  • Открытый исходный код

    Издатель навыка на GitHub — NeuroAIHub. Перед установкой изучите исходные материалы.

Установка

Установите навык ИИ Neural Population Analysis Guide в TypingMind, чтобы использовать его с любой LLM, или добавьте его в другой агент, который умеет читать SKILL.md.

1

Установка в TypingMind

TypingMind устанавливает навык прямо из его папки на GitHub: читает SKILL.md, собирает файлы ресурсов и сохраняет результат локально.

  1. Откройте приложение и перейдите в раздел «Плагины → Навыки».
  2. Выберите «Установить из GitHub».
  3. Вставьте указанную ниже ссылку на папку навыка и подтвердите установку.
    https://github.com/NeuroAIHub/BrainPilot/tree/main/packages/skills/skills/08_Computational_Neuroscience/neural-population-analysis-guide
  4. Включите навык в каждом чате, где хотите его использовать.
Плагины → Навыки → Добавить навык → По ссылке GitHub, затем вставьте ссылку на папку и нажмите «Продолжить».
2

Установка в другом агенте

Любой агент с поддержкой формата Agent Skills может использовать этот навык — скопируйте папку в каталог навыков этого агента.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/NeuroAIHub/BrainPilot.git /tmp/BrainPilot
mkdir -p .claude/skills
cp -r /tmp/BrainPilot/packages/skills/skills/08_Computational_Neuroscience/neural-population-analysis-guide .claude/skills/neural-population-analysis-guide
После копирования перезапустите Claude Code, чтобы загрузить новый навык.

Использование в TypingMind

Включите навык Neural Population Analysis Guide в любом чате TypingMind, и дальше модель всё сделает сама. Его название и описание хранятся в системном промпте, а при появлении подходящего запроса модель сама загружает полные инструкции. Вам не нужно вызывать навык вручную, и до фактического использования он не расходует токены.

Модель сама загружает навык Neural Population Analysis Guide, как только появляется подходящий для него запрос.

Работает с любой моделью ИИ

Навыки ИИ — это обычные инструкции в Markdown, а не код для конкретного поставщика, поэтому навык Neural Population Analysis Guide не привязан к модели, для которой он был создан. Установите его один раз в TypingMind и используйте с GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama или локальной моделью, которую запускаете самостоятельно, — со своими ключами API.

  • Загружается только при необходимости

    Системный промпт содержит только название и описание. Инструкции загружаются при первом подходящем запросе, поэтому неиспользуемый навык не расходует токены.

  • Меняйте модели прямо в чате

    Навык состоит из инструкций, а не кода, поэтому смена модели не нарушает его работу: новая модель читает тот же файл SKILL.md.

Инструкции навыка

Это содержимое файла SKILL.md, которое загружает модель. Прочитайте его перед установкой: навык — это инструкции, которым будет следовать ваша модель.

Neural Population Analysis Guide

Purpose

This skill encodes expert methodological knowledge for dimensionality reduction and latent-variable analysis of neural population recordings. A competent programmer without computational neuroscience training will get this wrong because:

  • Not all dimensionality reduction is the same. PCA, Factor Analysis, GPFA, and dPCA answer fundamentally different questions about neural data. PCA finds axes of maximum variance; dPCA demixes variance by task parameter; GPFA extracts smooth single-trial trajectories. Choosing the wrong method answers the wrong question (Cunningham & Yu, 2014).
  • Standard data science preprocessing destroys neural signal. Naive z-scoring or standard scaling of neural firing rates removes important information about rate differences across neurons. Soft normalization is required (Churchland et al., 2012).
  • Visualization methods are not analysis methods. t-SNE and UMAP produce visually compelling low-dimensional embeddings but their distances are not interpretable, axes are not meaningful, and results are sensitive to hyperparameters. They must never be used for quantitative inference (Cunningham & Yu, 2014).
  • Dimensionality is not determined by "percent variance explained." There is no universal threshold (e.g., 90%) for choosing the number of PCs. Parallel analysis or cross-validation is required to determine true dimensionality (Humphries, 2021).

When to Use This Skill

  • Analyzing simultaneously recorded neural populations (multi-electrode arrays, Neuropixels, calcium imaging)
  • Choosing between PCA, Factor Analysis, GPFA, dPCA, jPCA, or nonlinear methods
  • Extracting low-dimensional neural trajectories from spike trains
  • Demixing neural variance by task parameters (stimulus, decision, time)
  • Setting up population decoding analyses with temporal generalization
  • Determining data requirements (neuron counts, trial counts) for population analyses

Do NOT use this skill for:

  • Single-neuron tuning curve analysis (this is a different analytical framework)
  • Spike sorting or preprocessing of raw electrophysiology (upstream of this skill)
  • fMRI multivariate pattern analysis (see neural-decoding-analysis skill instead)

Research Planning Protocol

Before executing the domain-specific steps below, you MUST:

  1. State the research question -- What specific question is this analysis/paradigm addressing?
  2. Justify the method choice -- Why is this approach appropriate? What alternatives were considered?
  3. Declare expected outcomes -- What results would support vs. refute the hypothesis?
  4. Note assumptions and limitations -- What does this method assume? Where could it mislead?
  5. Present the plan to the user and WAIT for confirmation before proceeding.

For detailed methodology guidance, see the research-literacy skill.


⚠️ Verification Notice

This skill was generated by AI from academic literature. All parameters, thresholds, and citations require independent verification before use in research. If you find errors, please open an issue.

When to Use Population Analysis vs. Single-Neuron Analysis

Single-neuron analysis characterizes individual tuning curves and response properties. Population analysis characterizes the collective, low-dimensional structure of neural activity. Use population analysis when (Cunningham & Yu, 2014):

  • Neural responses are distributed across many neurons with no single neuron carrying the full signal
  • You want to characterize the geometry of neural representations (e.g., are stimulus and decision signals orthogonal?)
  • You want to track trajectories of population activity over time during behavior
  • Single-neuron tuning is mixed or complex, making classical tuning curve approaches uninformative
  • You have simultaneous recordings from tens to hundreds of neurons

Domain judgment: Population analysis does NOT require that individual neurons be untuned. Even populations of well-tuned neurons have emergent low-dimensional structure that single-neuron analyses miss. The question is whether the research question is about individual neuron properties or collective population geometry (Cunningham & Yu, 2014).


Method Selection Decision Tree

What is your research question?
|
+-- "What are the dominant patterns of co-variation across the population?"
| --> PCA (linear, static)
| Simplest method; start here
| Output: principal components, variance explained, projections
|
+-- "What are the smooth latent trajectories on single trials?"
| --> GPFA (Yu et al., 2009) or Factor Analysis
| For temporal structure; extracts trial-by-trial dynamics
| Output: latent trajectories per trial, dimensionality estimate
|
+-- "How is variance distributed across task parameters?"
| --> dPCA (Kobak et al., 2016)
| Demixes stimulus, decision, time, and interaction variance
| Output: demixed components, marginalization pie chart
|
+-- "Are there rotational dynamics in the population?"
| --> jPCA (Churchland et al., 2012)
| Finds rotational structure in neural trajectories
| Output: rotational plane projections, R^2 of rotational fit
|
+-- "I want to visualize population structure in 2-3D"
 --> t-SNE or UMAP -- VISUALIZATION ONLY
 NOT for quantitative analysis or distance comparisons
 Output: 2D/3D embedding (qualitative only)

PCA for Neural Data

Preprocessing Before PCA

  1. Trial averaging vs. single-trial: Trial-averaged PCA smooths out single-trial variability and is appropriate when the question is about condition-mean trajectories. Single-trial PCA preserves trial-to-trial variability but requires more data (Cunningham & Yu, 2014).

  2. Soft normalization (CRITICAL): Do NOT use standard z-scoring (subtract mean, divide by SD). This eliminates firing rate differences that carry information. Instead, use soft normalization (Churchland et al., 2012):

normalized_rate = (rate - mean) / (range + constant)

where constant is typically 5 spikes/s (Churchland et al., 2012). This prevents low-firing neurons from dominating due to noise amplification while preserving rate differences.

  1. Square-root transform: An alternative normalization for Poisson-like spike counts: sqrt(mean firing rate + constant) (Churchland et al., 2012). Stabilizes variance across neurons with different firing rates.

  2. Mean subtraction: Subtract the condition-averaged PSTH across all conditions from each condition. This removes the shared temporal modulation and focuses PCA on condition-discriminating variance (Kobak et al., 2016).

Determining Dimensionality

MethodDescriptionWhen to UseSource
Parallel analysisCompare eigenvalues to those from shuffled dataRecommended default; principled thresholdHumphries, 2021
Cross-validated PCAHold out neurons or time bins; test reconstructionAvoids overfitting; gold standardCunningham & Yu, 2014
Scree plot elbowSubjective visual inspectionQuick but unreliable; avoid for publicationExpert consensus
Percent variance thresholde.g., "keep PCs explaining 90%"NOT recommended; arbitrary thresholdHumphries, 2021

Domain judgment: There is no fixed variance-explained threshold for choosing the number of PCs. The "90% rule" from data science is meaningless for neural data because it confounds signal dimensionality with noise. Use parallel analysis (compare eigenvalues to those expected from random data with matched statistics) or cross-validation (Humphries, 2021).

Cross-Validated PCA

To avoid overfitting dimensionality estimates:

  1. Split neurons into two halves (or use leave-one-neuron-out)
  2. Fit PCA on one half
  3. Project the other half onto the PCs
  4. Measure reconstruction error as a function of the number of PCs
  5. Choose dimensionality where held-out reconstruction stops improving

This is especially critical with small neuron counts (<50 neurons) where noise dimensions can mimic signal dimensions (Cunningham & Yu, 2014).


GPFA -- Gaussian Process Factor Analysis

GPFA extracts smooth, low-dimensional latent trajectories from single-trial spike trains by combining factor analysis with Gaussian process temporal smoothing (Yu et al., 2009).

When to Use GPFA

  • You need single-trial latent trajectories (not just condition averages)
  • The research question involves trial-to-trial variability in population dynamics
  • You want an estimate of dimensionality that accounts for temporal smoothness

Key Parameters

ParameterRecommended ValueRationaleSource
Bin size20--50 msSmaller bins preserve temporal resolution but increase noise; 20 ms is standard for motor cortexYu et al., 2009
Latent dimensionsCross-validateFit models with 2--15 dimensions; select by leave-one-neuron-out cross-validation log-likelihoodYu et al., 2009
GP timescale (tau)Learned from dataEach latent dimension has its own timescale; inspect for biologically plausible values (10--500 ms)Yu et al., 2009

Data Requirements

  • Minimum simultaneously recorded neurons: ~50--100 for stable latent trajectories; below 30, estimates become unreliable (Yu et al., 2009; Cunningham & Yu, 2014)
  • Trial count: 50+ trials per condition for reliable single-trial extraction (Yu et al., 2009)
  • Stationarity assumption: GPFA assumes the mapping from latent variables to neurons is fixed across all trials in the dataset. Non-stationarities (e.g., learning, drift) violate this assumption

Domain judgment: GPFA is NOT simply "smoothed PCA." Factor analysis and PCA make different assumptions about noise structure. PCA treats all variance as signal; factor analysis separates shared (signal) variance from private (noise) variance per neuron. GPFA adds temporal smoothness to the shared component. This distinction matters when neurons have heterogeneous noise levels (Yu et al., 2009).


dPCA -- Demixed Principal Component Analysis

dPCA finds linear projections that capture maximum variance attributable to specific task parameters (e.g., stimulus identity, decision, time, and their interactions), rather than maximum total variance like PCA (Kobak et al., 2016).

When to Use dPCA

  • You have a factorial experimental design with multiple task parameters
  • You want to know how much population variance is explained by each parameter
  • You want to visualize how stimulus, decision, and temporal signals are mixed or separated in the population

Key Procedures

  1. Marginalization: Partition the data tensor by task parameter (e.g., average over all decisions to isolate stimulus variance). dPCA finds components that maximize variance within each marginalization (Kobak et al., 2016).

  2. Regularization: The regularization parameter lambda controls the tradeoff between demixing (fidelity to marginalization) and reconstruction (total variance captured). Select lambda by cross-validation (Kobak et al., 2016):

  • Hold out a subset of trials
  • Fit dPCA on remaining trials for a range of lambda values
  • Choose lambda that minimizes reconstruction error on held-out trials
  1. Significance testing: Use a shuffle test to determine whether each component captures significantly more marginalized variance than expected by chance:
  • Shuffle condition labels for the parameter of interest (1000+ iterations)
  • Recompute dPCA on shuffled data
  • Compare observed marginalized variance to the null distribution (Kobak et al., 2016)
  1. Marginalization pie chart: Report the proportion of total variance explained by each marginalization (stimulus, decision, time, interaction). This provides a concise summary of how the population mixes task variables (Kobak et al., 2016).

Data Requirements

  • Trial counts: 20+ trials per condition minimum; more for stable interaction terms (Kobak et al., 2016)
  • Neuron counts: Works with as few as 20--30 neurons but more reliable with 50+ (Kobak et al., 2016)
  • Factorial design: dPCA requires a balanced factorial design; missing conditions or severely unbalanced cell sizes degrade performance

Population Decoding

Classifier Selection for Neural Populations

ClassifierWhen to UseSource
Linear SVMDefault; robust for high-dimensional population dataCunningham & Yu, 2014
LDAWhen number of neurons << number of trialsCunningham & Yu, 2014
Logistic RegressionWhen probability estimates are neededCunningham & Yu, 2014

Cross-Validation for Neural Data

StrategyWhen to UseSource
Leave-one-trial-outSmall trial counts; maximizes training dataCunningham & Yu, 2014
Stratified k-fold (k=5--10)Sufficient trials; balances bias/varianceCunningham & Yu, 2014

Temporal Generalization Matrix

Train a classifier at time t, test at all times t'. The resulting matrix reveals dynamics of neural coding (King & Dehaene, 2014):

  • Diagonal pattern: Transient coding; neural representation changes over time
  • Block pattern: Stable, sustained representation
  • Off-diagonal: Reactivation of earlier representations

See the neural-decoding-analysis skill for detailed guidance on temporal generalization.


Common Pitfalls

1. Using Standard Z-Scoring Instead of Soft Normalization

Standard z-scoring (subtract mean, divide by SD) amplifies noise from low-firing neurons and eliminates informative rate differences. Always use soft normalization or square-root transform for neural population data (Churchland et al., 2012).

2. Interpreting t-SNE/UMAP Distances as Meaningful

t-SNE and UMAP distort distances, create spurious clusters, and are sensitive to hyperparameters (perplexity, n_neighbors). They are useful for visualization but must NEVER be used for quantitative claims about distance, clustering, or dimensionality (Cunningham & Yu, 2014).

3. Using Percent Variance Explained to Choose Dimensionality

There is no universal threshold. The correct approach is parallel analysis (compare to null eigenvalue distribution) or cross-validated reconstruction (Humphries, 2021).

4. Applying GPFA to Condition-Averaged Data

GPFA is designed for single-trial data. Applying it to trial-averaged PSTHs defeats its purpose (separating shared latent signal from private noise) and provides no advantage over PCA (Yu et al., 2009).

5. Ignoring Neuron Count Requirements

Population analyses have minimum neuron requirements for reliable estimates. Below ~30 simultaneously recorded neurons, dimensionality estimates from PCA are dominated by noise; GPFA latent trajectories become unstable below ~50 neurons (Cunningham & Yu, 2014; Yu et al., 2009).

6. Not Cross-Validating dPCA Regularization

Using default or arbitrary regularization parameters in dPCA can either over-demix (fitting noise) or under-demix (missing true task-related structure). Always cross-validate lambda (Kobak et al., 2016).


Minimum Reporting Checklist

Based on Cunningham & Yu (2014), Kobak et al. (2016), and Yu et al. (2009):

  • Number of simultaneously recorded neurons and recording method
  • Neuron inclusion criteria (e.g., minimum firing rate, signal quality)
  • Normalization method (soft normalization constant, or square-root transform)
  • Method used and justification (PCA, GPFA, dPCA, jPCA)
  • Dimensionality selection method (parallel analysis, cross-validation) and chosen dimensionality
  • For GPFA: bin size, number of latent dimensions, learned GP timescales
  • For dPCA: regularization parameter, cross-validation procedure, shuffle test results
  • Trial counts per condition
  • Variance explained (total and per component/marginalization)
  • Software and version used (e.g., GPFA code from Yu et al., dPCA Python/MATLAB toolbox)

Key References

  • Churchland, M. M., Cunningham, J. P., Kaufman, M. T., Foster, J. D., Nuyujukian, P., Ryu, S. I., & Shenoy, K. V. (2012). Neural population dynamics during reaching. Nature, 487(7405), 51--56.
  • Cunningham, J. P., & Yu, B. M. (2014). Dimensionality reduction for large-scale neural recordings. Nature Neuroscience, 17(11), 1500--1509.
  • Humphries, M. D. (2021). Strong and weak principles of neural dimension reduction. Neuron, 109(8), 1230--1234.
  • King, J.-R., & Dehaene, S. (2014). Characterizing the dynamics of mental representations: The temporal generalization method. Trends in Cognitive Sciences, 18(4), 203--210.
  • Kobak, D., Brendel, W., Constantinidis, C., Feierstein, C. E., Kepecs, A., Mainen, Z. F., Qi, X.-L., Romo, R., Uchida, N., & Machens, C. K. (2016). Demixed principal component analysis of neural population data. eLife, 5, e10989.
  • Yu, B. M., Cunningham, J. P., Santhanam, G., Ryu, S. I., Shenoy, K. V., & Sahani, M. (2009). Gaussian-process factor analysis for low-dimensional single-trial analysis of neural population activity. Journal of Neurophysiology, 102(1), 614--635.

See references/method-comparison.md for detailed parameter tables and software recommendations. See references/data-requirements.md for minimum neuron and trial count guidelines by method.

Файлы в комплекте

Модель читает эти файлы по мере необходимости, пока навык загружен. Они доступны только для чтения и никогда не выполняются.

Часто задаваемые вопросы

Что делает навык ИИ Neural Population Analysis Guide?

Guides dimensionality reduction and latent-variable analysis of neural populations (PCA, GPFA, dPCA)

Зачем использовать Neural Population Analysis Guide в TypingMind?

Потому что вы устанавливаете навык один раз и используете его с любой моделью. Neural Population Analysis Guide — это обычный текст в формате Markdown, а не код для конкретного поставщика, поэтому один и тот же навык работает с GPT-5, Claude, Gemini, Grok или локальной моделью. Вы можете менять модель прямо во время чата, и навык продолжит работать. TypingMind использует ваши собственные ключи API, поэтому вы платите поставщикам напрямую, а не оформляете подписку с оплатой за каждое место. Ваши навыки и чаты остаются в вашем собственном хранилище.

Как установить Neural Population Analysis Guide в TypingMind?

В TypingMind откройте «Плагины → Навыки → Установить из GitHub» и вставьте https://github.com/NeuroAIHub/BrainPilot/tree/main/packages/skills/skills/08_Computational_Neuroscience/neural-population-analysis-guide. TypingMind прочитает файл SKILL.md, включит сопутствующие файлы в пакет и установит навык, который можно включать отдельно для каждого чата.

Какие модели ИИ могут использовать Neural Population Analysis Guide?

Любая модель, которую вы подключите в TypingMind. Навыки ИИ — это обычные инструкции в формате Markdown, а не код для конкретного поставщика, поэтому GPT, Claude, Gemini, Grok и локальные модели могут загружать этот навык, когда запрос ему соответствует.

Со сколькими моделями ИИ можно использовать Neural Population Analysis Guide?

С любым количеством. В TypingMind вы можете использовать Neural Population Analysis Guide с любой моделью, которая поддерживает навыки, в том числе с GPT, Claude, Gemini, Grok, DeepSeek, Mistral и Llama. Для этого вы используете собственные ключи API.

Бесплатен ли навык ИИ Neural Population Analysis Guide?

Да. Навык опубликован на GitHub по лицензии AGPL-3.0. Издатель — NeuroAIHub. Вы платите только своему поставщику ИИ за использованные токены.

Что такое навыки ИИ?

Навык ИИ — это набор инструкций, которыми модель ИИ может пользоваться каждый раз, когда ей нужно выполнить конкретную задачу. Он соответствует открытому формату Agent Skills: файл SKILL.md с названием и описанием, а также любые скрипты, шаблоны или справочные файлы, которые могут понадобиться модели. Модель читает инструкции, только когда ваш запрос соответствует навыку, поэтому установленный навык ничего не стоит, пока не используется.

Чем навыки ИИ отличаются от плагинов и серверов MCP?

Плагин или сервер MCP даёт модели новые инструменты, которые она может вызывать: при вызове где-то выполняется код и возвращает результат. Навык ИИ, напротив, даёт модели знания и описывает порядок действий: как подойти к задаче, какие шаги выполнить и каким должен быть хороший результат. Навыки — это обычный текст в формате Markdown, поэтому им не нужны сервер, ключ API или среда выполнения, и они работают с любой моделью.

Все

Создайте своё рабочее пространство с ИИ прямо сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇