Data and scripts used in: "Exploring Biological Neuronal Correlations with Quantum Generative Models"
收藏资源简介:
Data and script for the manuscript "Exploring Biological Neuronal Correlations with Quantum Generative Models", by Vinicius Hernandes and Eliska Greplova. main scripts generate_activity_dataset.py reshape data in neuronData.npy to 50k samples of (neurons, timesteps) shape, saved in activity_data.npy create_target_distributions.py based on the dataset, makes dicionary with the the target distribution for each (neurons, timesteps) pair, saved in distribution_target_dictionary.pkl create_hyperparameters_file.py generates hyperparameters.csv, containing: number of neurons number of timesteps number of auxiliary_qubits batch_size learning rate of generator learning rate of critic number parametrized layers number of training iterations loss type for each run train_qgan.py trains models defined models.py using activity_data.npy dataset, and for the hyperparameters defined in hyperparameters.csv saves loss functions, and the trained models for each 10 iterations, in specific folders indexed by the run specified in the hyperparameters file generate_fake_activity.py uses trained models saved in output/models/run{run}/i{training_step}.pth for a specific training_step and run to generate fake data, and save them in output/generated_data/run{run}/i{training_step}.npy files analyze_error.py uses generated data saved in output/generated_data/run{run}/i{training_step}.npy to generate two statistical quantities (k-probs and firing rate), using the function in metrics.py, and compare the errors in those quantities between the models using k-loss and standard-loss analyze_stats.py uses generated data saved in output/generated_data/run{run}/i{training_step}.npy to generate: js diverge for each training step, and final distribution of generated states, stored in distribution_target_dictionary.pkl other statistical quantities, using the function in metrics.py file auxiliary scripts metrics.py functions to calculate neuronal statistics aux.py auxiliary functions: to generate states distribution given a dataset custom js divergence Data neuronData.npy neuronal data from Marre et al., Multi-electrode array recording from salamander retinal ganglion cells (2017) activity_data.npy dataset obtained from neuronData.npy, taking 50 thousand samples of shape (neurons, timesteps) output results obtained from train_qgan.py and generate_fake_activity.py contains: losses generator and critic loss for all training runs and steps models saved torch models every 10 training steps, for all training runs generated_data generated data for all models saved in models
本数据集配套代码与数据来自Vinicius Hernandes与Eliska Greplova撰写的论文《Exploring Biological Neuronal Correlations with Quantum Generative Models》(《基于量子生成模型探究生物神经元关联特性》)。 ### 主脚本 1. generate_activity_dataset.py:将neuronData.npy中的数据重塑为50000个(神经元, 时间步长)形状的样本,保存至activity_data.npy。 2. create_target_distributions.py:基于上述数据集,为每个(神经元, 时间步长)对生成目标分布字典,保存为distribution_target_dictionary.pkl。 3. create_hyperparameters_file.py:生成hyperparameters.csv文件,其中每条训练运行记录包含以下参数:神经元数量、时间步长数量、辅助量子比特(auxiliary_qubits)数量、批量大小(batch_size)、生成器学习率、判别器(critic)学习率、参数化层(parametrized layers)数量、训练迭代次数、损失函数类型。 4. train_qgan.py:使用models.py中定义的模型,结合activity_data.npy数据集,并基于hyperparameters.csv中指定的超参数开展训练;每10个训练迭代周期保存一次损失函数与训练好的PyTorch(torch)模型,保存至由超参数文件中指定的运行编号索引的专属文件夹中。 5. generate_fake_activity.py:调用保存在output/models/run{run}/i{training_step}.pth中的训练模型,针对指定的训练步骤与运行编号生成伪数据,并将其保存至output/generated_data/run{run}/i{training_step}.npy文件中。 6. analyze_error.py:利用保存在output/generated_data/run{run}/i{training_step}.npy中的生成数据,通过metrics.py中的函数计算两类统计量(k概率与放电率),并对比采用k-loss与standard-loss的模型在这些统计量上的误差差异。 7. analyze_stats.py:利用保存在output/generated_data/run{run}/i{training_step}.npy中的生成数据,完成以下任务:计算每个训练步骤的JS散度(JS divergence),以及存储于distribution_target_dictionary.pkl中的生成态最终分布;同时通过metrics.py中的函数计算其他统计量。 ### 辅助脚本 1. metrics.py:用于计算神经元统计特性的函数集合。 2. aux.py:辅助函数集合,包括:基于给定数据集生成状态分布、自定义JS散度计算。 ### 数据 - neuronData.npy:来自Marre等人2017年的研究,包含蝾螈视网膜神经节细胞的多电极阵列记录得到的神经元数据。 - activity_data.npy:由neuronData.npy处理得到的数据集,选取50000个(神经元, 时间步长)形状的样本。 ### 输出目录 存放train_qgan.py与generate_fake_activity.py运行得到的结果,包含以下子目录: - losses:存储所有训练运行与步骤的生成器与判别器损失值 - models:存储所有训练运行每10个训练步骤保存的PyTorch(torch)模型 - generated_data:存储所有模型生成的伪数据



