人脑认知计算模型简介(上)
引入
這是本系列的第一篇文章,即“腹側顳葉皮層時空功能磁共振成像的認知計算建模”。
將介紹認知計算建模的主題及其在大腦解碼研究中的使用案例。讓我們開始吧。
所有相關資料都位于我的Github頁面上。別忘了去看看。如果你是一個論文愛好者,你可以閱讀本系列文章的論文版,也可以在我的倉庫中找到。
https://github.com/cankocagil/Cognitive-Computational-Modelling-for-Spatio-Temporal-fMRI-in-Ventral-Temporal-Cortex
人腦腹側顳葉皮層對來自自然界的視覺刺激的不同表現具有選擇性,腹側物體視覺通路產生分布和重疊的神經反應[21]。
進行單細胞研究,以證明非人靈長類動物腹側顳葉皮質中單個神經元的差異調整對不同種類的物體具有選擇性,并形成代表性特征[6,21]。
然而,它們的選擇性順序不可概括,也不能擴展到更高程度的對象表示[8]。為了模擬腹側皮質的神經結構,我們開發了統計算法,但該通路的不確定性仍然存在。
關于神經成像的最新進展表明,人類感知、記憶和思想的時空解碼可以通過功能磁共振成像(fMRI)方法進行解碼[11]。然而,由于時空分辨率的神經能力,功能磁共振成像數據的復雜性和分布需要復雜的科學工具。
隨著機器學習的發展,神經科學家在大規模功能磁共振成像數據集中發現統計和結構模式,以解決神經科學背景下的各種任務。此外,深度學習的最新進展使研究人員能夠解決尚未解決的神經科學任務[12],并具體說明了深度學習的重要性。
在這項研究中,我們構建了端到端的發現機器學習管道,以解碼人類受試者基于功能磁共振成像數據觀察到的視覺刺激類別。
我們利用最先進的解釋性神經成像技術,如回聲平面、感興趣區(RoI)、統計圖、解剖和玻璃腦方法,對功能磁共振樣本的視覺結構進行可視化和預分析。
我的實驗基于一個區塊設計的4-D時間序列功能磁共振數據集,即哈克斯比數據集[7,15,8],該數據集來自人臉和物體表征的研究。它由6名受試者組成,每個受試者12次實驗[8]。
每次實驗,受試者被動地觀看八個物體類別的灰度圖像,這些圖像按24秒的時間段分組,以休息時間分隔[8,7]。每幅圖像顯示500ms,然后是1500ms的刺激間隔[7]。
全腦功能磁共振成像數據以2.5s重復時間記錄。它由每個受試者的高分辨率解剖圖像組成,但第六個4D特征磁共振成像時間序列圖像數據除外,其形狀為1452,包含40x64x64個體素(對應于3.5 x 3.75 x 3.75 mm的體素大小和2.5秒重復時間)[8]。
我們有8種不同的刺激類型,分別是剪刀、臉、貓、拼圖、瓶子、椅子、鞋子和房子。靜止狀態塊被消除,因為它不提供關于解碼視覺刺激的額外信息[8]。
在深入研究獲取Haxby數據集的Python代碼及其探索性功能磁共振成像分析之前,讓我們先從鳥瞰的角度來了解整個分析,以及如何在神經解碼的背景下執行認知計算建模。
1.發現神經影像學分析
作為探索神經成像分析,我們采用了最先進的解釋性神經成像技術,如回聲平面、感興趣區(RoI)、統計圖、解剖和玻璃腦方法,以可視化和預分析功能磁共振樣本的視覺結構。我們將在系列文章的第二部分深入討論。
2.腹側顳葉皮質的功能連通性和相似性分析
我們進行了基于相關性、精確度和偏相關的功能連接性分析,以及基于余弦、minkowski和歐幾里德距離的相似性分析,以發現腹側顳葉皮質的重疊表達。
這在解釋性功能磁共振成像分析中非常有用,因為它顯示了人腦中的分布區域如何從統計和數學角度共享相似的特征。我們將在系列文章的第三部分深入討論。
3.人腦分布區域的流形學習和降維
在每個受試者的腹側時間掩碼上執行流形學習和降維方法,以提取時空掩碼的潛在變量,這將有助于進一步解碼人腦。
作為降維方法,我們應用了主成分分析(PCA)、線性判別分析(LDA)、獨立成分分析(ICA)、非負矩陣分解(NNMF)和多維尺度分析(MDS),然后通過三維可視化比較這些獲得的子空間。
此外,我們執行流形學習算法來提取隱藏的腹側顳區的潛在流形分布。我們執行了t-隨機鄰域嵌入(t-SNE)、統一流形近似和投影(UMAP)、ISOMAP、局部線性嵌入(LLE)和譜嵌入(SE),然后通過它們的三維可視化來比較它們的低維流形,進一步幫助解碼過程。
這將全面介紹如何理解人腦腹側顳葉皮質。從ML的角度來看,這將是對無監督學習和人腦交叉點的深入回顧。我們將在系列文章的第四部分深入討論。
在這一點上,我們只進行發現分析,以了解功能磁共振成像數據樣本及其分布。接下來,我們將深入了解解碼過程。
4.時空功能磁共振成像解碼:ML和DL算法
端到端機器學習算法被開發用于根據腹側顳葉皮層的分布和重疊區域對刺激進行分類。
準確地說,我們執行了以下機器學習算法;線性支持向量分類器(LinearSVC)、隨機梯度下降分類器(SGDClassizer)、多層感知器(MLP)、感知器、邏輯回歸、邏輯回歸交叉驗證、支持向量分類器(SVC)、校準分類器(等滲回歸概率校準)、被動攻擊分類器、,標簽傳播分類器、隨機森林分類器、梯度增強分類器、二次判別分類器、脊分類器交叉驗證、脊分類器、AdaBoost分類器、額外樹分類器、K-近鄰分類器、貝努利樸素貝葉斯分類器、高斯樸素貝葉斯分類器、Nu支持向量分類器、,最近質心分類器和bagging分類器。
作為一種魯棒的集成解碼,我們采用了新的正則化模型集成;FREM:L2正則化SVC的交叉驗證集合,FREM:L2正則化邏輯回歸的交叉驗證集合。我們進一步構建了認知神經網絡,利用不同視覺表征流之間的交互作用,精確地構建了具有GELU非線性的MLP[10],二維和三維卷積神經網絡。
我們將在本系列文章的第五部分深入討論,這將是本系列的最后一篇文章。
是的,太大了。我知道,但執行許多解碼實驗并比較它們的結果是至關重要的。不用擔心,我們將在“兩”行代碼中實現幾乎所有的ML算法。
讓我們開始編碼吧。在本文中,我們將僅使用“nilearn”框架從web下載Haxby數據集,該框架將在后面的系列文章中介紹,并探索數據集的結構。
首先,我們需要安裝必要的Python包。打開你喜愛的Jupyter筆記本,復制并粘貼以下代碼,以便進行必要的安裝。
!pip?install?umap !pip?install?pipreqs !pip?install?lazypredict !pip?install?nibabel !pip?install?nilearn !pip?install?-U?kaleidotry:import?sklearnprint('Scikit-learn?is?available,?version',?sklearn.__version__)except:!pip?install?scikit-learntry:import?numpy?as?npprint('Numpy?is?available,?version',?np.__version__)except:!pip?install?numpytry:import?pandas?as?pdprint('Pandas?is?available,?version',?pd.__version__)except:!pip?install?pandastry:import?scipyprint('?Scipy?is?available,?version',?scipy.__version__)except:!pip?install?scipytry:import?plotlyexcept:!pip?install?plotly然后,讓我們導入所有必要的包。如果要保存結果,請創建一個名為“images”和“results”的文件夾,或者只需刪除下面的第66-67行即可。
from?__future__?import?print_function,?division#?基礎包: import?numpy?as?np,pandas?as?pd,?matplotlib.pyplot?as?plt import?os,?random,?time,?sys,?copy,?math,?pickle#?交互模式 plt.ion()#?忽略警告 import?warnings warnings.filterwarnings("ignore")#?繪圖 import?plotly.io?as?plt_io import?plotly.graph_objects?as?go %matplotlib?inline#?降維算法: from?sklearn.decomposition?import?PCA from?sklearn.manifold?import?TSNE from?sklearn.discriminant_analysis?import?LinearDiscriminantAnalysis?as?LDA from?sklearn.decomposition?import?FastICA from?sklearn.decomposition?import?NMF import?umap#?轉換 from?sklearn.preprocessing?import?StandardScaler from?sklearn.preprocessing?import?MinMaxScaler#?指標:: from?sklearn.metrics?import?classification_report#?Train-Test分割 from?sklearn.model_selection?import?train_test_split#?對于經典的ML算法: from?lazypredict.Supervised?import?LazyClassifier#?進度條: from?tqdm?import?tqdm#?距離測量: from?scipy.spatial.distance?import?cdist#?額外: from?abc?import?abstractmethod from?typing?import?Callable,?Iterable,?List,?Tuple#?谷歌Colab設置為true: COLAB?=?Falseif?COLAB:#?訪問谷歌驅動器:from?google.colab?import?drivedrive.mount("/content/gdrive")#?神經成像: from?nibabel.testing?import?data_path from?nilearn?import?plotting?as?nplt from?nilearn.input_data?import?NiftiMasker from?nilearn?import?datasets from?nilearn?import?plotting from?nilearn.image?import?mean_img from?nilearn.image?import?index_img import?nibabel?as?nib from?nilearn?import?imageprint("NumPy?Version:?",?np.__version__)root_dir?=?os.getcwd() image_results_dir?=?os.path.join(root_dir,?'images') results_dir?=?os.path.join(root_dir,?'results')我們準備好出發了!請閱讀下面的docstring以便理解Haxby數據集,第一眼看到它可能不容易理解,但不用擔心。稍后我們將進一步討論。
請注意,從web下載數據大約需要30分鐘,具體時間取決于你的下載速度等。
"""? Experimental?View?of?the?Haxby?(Faces?and?Objects?in?Ventral?Temporal?Cortex?(fMRI))?Dataset:? This?is?a?block-design?fMRI?dataset?(Haxby)?from?a?study?on?face?and?object?representation?in human?ventral?temporal?cortex.?It?consists?of?6?subjects?with?12?runs?per?subject. In?each?run,?the?subjects?passively?viewed?greyscale?images?of?eight?object?categories, grouped?in?24s?blocks?separated?by?rest?periods.?Each?image?was?shown?for?500ms? and?was?followed?by?a?1500ms?inter-stimulus?interval.? Full-brain?fMRI?data?were?recorded?with?a?volume?repetition?time?of?2.5s, thus,?a?stimulus?block?was?covered?by?roughly?9?volumes. --- Dataset?Description 1.?anat.nii.gz -?High?resolution?anatomical?image.?For?subject?6?there?is?no?anatomical?image?available. 2.bold.nii.gz-?4D?fMRI?timeseries?image.?(1452?volumes?with?40?x?64?x?64?voxels,? corresponding?to?a?voxel?size?of?3.5?x?3.75?x?3.75?mm?and a?volume?repetition?time?of?2.5?seconds).? The?timeseries?contains?all?12?runs?of?the?original?experiment, concatenated?in?a?single?file.?Please?note,?that?the?timeseries?signal?is?not?detrended. 3.mask*.nii.gz -?Various?masks?in?functional?space?provided?by?the?original?authors. “vt”?refers?to?“ventral?temporal”,?“face”?and?“house”?masks?are?GLM?contrast?based?localizer?maps. 4.labels.txt -?A?two-column?text?file?with?the?stimulation?condition?and?the?corresponding?experimental?run?for each?volume?in?the?timeseries?image.?Labels?are?given?in?literal?form?(e.g.?‘face’). --- We?have?8?different?stimuli?categories?that?are?:? scissors,?face,?cat,?scrambledpix,?bottle,?chair,?shoe,?house. We'll?work?with?haxby?dataset?that?can?be?downloaded?directly?from?the?neuroimaging?library?Nilearn.? There?are?6?subjects?in?the?experiment?that?will?be?downloaded?seperately?with?their?fMRI?images?and?masks. These?fMRI?images?are?4-D?nifti?images. """#?實驗共有6名被試: haxby_dataset?=?datasets.fetch_haxby(subjects=?[1,2,3,4,5,6])是的,我們下載了功能磁共振成像數據集。當你打印haxby_dataset時,你將看到這樣一個結果
{'anat':?['C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj1\\anat.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj2\\anat.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj3\\anat.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj4\\anat.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj5\\anat.nii.gz',None],'func':?['C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj1\\bold.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj2\\bold.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj3\\bold.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj4\\bold.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj5\\bold.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj6\\bold.nii.gz'],'session_target':?['C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj1\\labels.txt','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj2\\labels.txt','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj3\\labels.txt','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj4\\labels.txt','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj5\\labels.txt','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj6\\labels.txt'],'mask_vt':?['C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj1\\mask4_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj2\\mask4_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj3\\mask4_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj4\\mask4_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj5\\mask4_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj6\\mask4_vt.nii.gz'],'mask_face':?['C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj1\\mask8b_face_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj2\\mask8b_face_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj3\\mask8b_face_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj4\\mask8b_face_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj5\\mask8b_face_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj6\\mask8b_face_vt.nii.gz'],'mask_house':?['C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj1\\mask8b_house_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj2\\mask8b_house_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj3\\mask8b_house_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj4\\mask8b_house_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj5\\mask8b_house_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj6\\mask8b_house_vt.nii.gz'],'mask_face_little':?['C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj1\\mask8_face_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj2\\mask8_face_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj3\\mask8_face_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj4\\mask8_face_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj5\\mask8_face_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj6\\mask8_face_vt.nii.gz'],'mask_house_little':?['C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj1\\mask8_house_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj2\\mask8_house_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj3\\mask8_house_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj4\\mask8_house_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj5\\mask8_house_vt.nii.gz','C:\\Users\\Administrator/nilearn_data\\haxby2001\\subj6\\mask8_house_vt.nii.gz'],'mask':?'C:\\Users\\Administrator/nilearn_data\\haxby2001\\mask.nii.gz','description':?b'Haxby?2001?results\n\n\nNotes\n-----\nResults?from?a?classical?fMRI?study?that?investigated?the?differences?between\nthe?neural?correlates?of?face?versus?object?processing?in?the?ventral?visual\nstream.?Face?and?object?stimuli?showed?widely?distributed?and?overlapping\nresponse?patterns.\n\nContent\n-------\nThe?"simple"?dataset?includes\n????:\'func\':?Nifti?images?with?bold?data\n????:\'session_target\':?Text?file?containing?session?data\n????:\'mask\':?Nifti?images?with?employed?mask\n????:\'session\':?Text?file?with?condition?labels\n\n\nThe?full?dataset?additionally?includes\n????:\'anat\':?Nifti?images?with?anatomical?image\n????:\'func\':?Nifti?images?with?bold?data\n????:\'mask_vt\':?Nifti?images?with?mask?for?ventral?visual/temporal?cortex\n????:\'mask_face\':?Nifti?images?with?face-reponsive?brain?regions\n????:\'mask_house\':?Nifti?images?with?house-reponsive?brain?regions\n????:\'mask_face_little\':?Spatially?more?constrained?version?of?the?above\n????:\'mask_house_little\':?Spatially?more?constrained?version?of?the?above\n\n\nReferences\n----------\nFor?more?information?see:\nPyMVPA?provides?a?tutorial?using?this?dataset?:\nhttp://www.pymvpa.org/tutorial.html\n\nMore?informations?about?its?structure?:\nhttp://dev.pymvpa.org/datadb/haxby2001.html\n\n\n`Haxby,?J.,?Gobbini,?M.,?Furey,?M.,?Ishai,?A.,?Schouten,?J.,\nand?Pietrini,?P.?(2001).?Distributed?and?overlapping?representations?of\nfaces?and?objects?in?ventral?temporal?cortex.?Science?293,?2425-2430.`\n\n\nLicence:?unknown.\n'}讓我們簡要討論一下輸出。上面有詳細的描述,你還可以訪問Haxby數據集的參考資料。有
anat:功能磁共振成像數據的解剖結構
func:fMRI數據的Nifti圖像(將轉換為NumPy矩陣)
session_target :對應于我們的目標變量(將在后面討論)
mask, mask_vt, mask_faces, … (用于提取腹側顳葉皮層激活區域的不同空間掩碼)
這里,我們打印受試者的功能磁共振成像數據的文件名。不要擔心“nii.gz”格式。它只是功能磁共振成像數據的有效表示。
我們將使用“Nilearn”庫輕松解碼此擴展,并將其轉換為NumPy數組。
num_subjects?=?6for?subject?in?range(num_subjects):???#??'func'是一個文件名列表:每個主題一個文件名fmri_filename?=?haxby_dataset.func[subject]#?打印數據集的基本信息print('Subject?functional?nifti?images?(4D)?are?at:?%s'?%fmri_filename)??#?4D?數據""" Result:?? Subject?functional?nifti?images?(4D)?are?at:?C:\Users\Administrator/nilearn_data\haxby2001\subj1\bold.nii.gz Subject?functional?nifti?images?(4D)?are?at:?C:\Users\Administrator/nilearn_data\haxby2001\subj2\bold.nii.gz Subject?functional?nifti?images?(4D)?are?at:?C:\Users\Administrator/nilearn_data\haxby2001\subj3\bold.nii.gz First?subject?functional?nifti?images?(4D)?are?at:?C:\Users\Administrator/nilearn_data\haxby2001\subj4\bold.nii.gz First?subject?functional?nifti?images?(4D)?are?at:?C:\Users\Administrator/nilearn_data\haxby2001\subj5\bold.nii.gz First?subject?functional?nifti?images?(4D)?are?at:?C:\Users\Administrator/nilearn_data\haxby2001\subj6\bold.nii.gz """這篇文章到此為止。我們介紹了我們如何以及為什么構建時空計算技術來理解人腦。我們從網上下載了Haxby數據集。討論了數據集。最后,簡要回顧了數據集。
☆ END ☆
如果看到這里,說明你喜歡這篇文章,請轉發、點贊。微信搜索「uncle_pn」,歡迎添加小編微信「 woshicver」,每日朋友圈更新一篇高質量博文。
↓掃描二維碼添加小編↓
總結
以上是生活随笔為你收集整理的人脑认知计算模型简介(上)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: tp控制器进阶页面跳转重定向、
- 下一篇: 20190729 现代田园女权