Python:TransportableException:TransportableException
我正在使用一个名为Pyrcca的在线软件包。我正在运行本教程:但使用我自己的输入代码:Python:TransportableException:TransportableException,python,python-3.x,pyrcca,Python,Python 3.x,Pyrcca,我正在使用一个名为Pyrcca的在线软件包。我正在运行本教程:但使用我自己的输入代码: # Split into training and validation data TCIA_train, TCIA_test = train_test_split(TCIA_reduced, test_size=0.2) TCGA_train, TCGA_test = train_test_split(TCGA, test_size=0.2) # Initialize a cca object as an
# Split into training and validation data
TCIA_train, TCIA_test = train_test_split(TCIA_reduced, test_size=0.2)
TCGA_train, TCGA_test = train_test_split(TCGA, test_size=0.2)
# Initialize a cca object as an instantiation of the CCACrossValidate class.
ccaCV = rcca.CCACrossValidate(kernelcca=False, numCCs = [5,10], regs = [0.8, 0.5, 0.1, 1e2])
# Use the train() and validate() methods to run the analysis and perform cross-dataset prediction.
ccaCV.train([TCIA_train, TCGA_train])
testcorrsCV = ccaCV.validate([TCIA_test, TCGA_test])
基于此,我遇到了一个以前从未见过的错误,无法调试。我希望得到一些帮助。谢谢
上面说
“TransportableException:TransportableException”
错误日志:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-113-c44a925b202d> in <module>()
3
4 # Use the train() and validate() methods to run the analysis and perform cross-dataset prediction.
----> 5 ccaCV.train([TCIA_train, TCGA_train], False)
6 testcorrsCV = ccaCV.validate([TCIA_test, TCGA_test])
~/PycharmProjects/thesis_code/Thesis_code/Packages/rcca.py in train(self, data, parallel)
171 kernelcca=self.kernelcca, ktype=self.ktype,
172 gausigma=self.gausigma, degree=self.degree,
--> 173 cutoff=self.cutoff, selection=selection)
174 running_corr_mean_sum += fold_corr_mean
175
~/PycharmProjects/thesis_code/Thesis_code/Packages/rcca.py in train_cvfold(data, reg, numCC, kernelcca, ktype, gausigma, degree, cutoff, selection)
202 for ind in chunk]
203 notheldinds = list(set(range(nT)) - set(heldinds))
--> 204 comps = kcca([d[notheldinds] for d in data], reg, numCC,
205 kernelcca=kernelcca, ktype=ktype,
206 gausigma=gausigma, degree=degree)
~/PycharmProjects/thesis_code/Thesis_code/Packages/rcca.py in <listcomp>(.0)
202 for ind in chunk]
203 notheldinds = list(set(range(nT)) - set(heldinds))
--> 204 comps = kcca([d[notheldinds] for d in data], reg, numCC,
205 kernelcca=kernelcca, ktype=ktype,
206 gausigma=gausigma, degree=degree)
~/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py in __getitem__(self, key)
2131 if isinstance(key, (Series, np.ndarray, Index, list)):
2132 # either boolean or fancy integer index
-> 2133 return self._getitem_array(key)
2134 elif isinstance(key, DataFrame):
2135 return self._getitem_frame(key)
~/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py in _getitem_array(self, key)
2175 return self._take(indexer, axis=0, convert=False)
2176 else:
-> 2177 indexer = self.loc._convert_to_indexer(key, axis=1)
2178 return self._take(indexer, axis=1, convert=True)
2179
~/anaconda3/lib/python3.6/site-packages/pandas/core/indexing.py in _convert_to_indexer(self, obj, axis, is_setter)
1267 if mask.any():
1268 raise KeyError('{mask} not in index'
-> 1269 .format(mask=objarr[mask]))
1270
1271 return _values_from_object(indexer)
KeyError: '[ 0 1 2 4 5 6 7 8 9 10 11 12 13 14 15 18 19 20 22 23 24 25 26 27\n 28 30 34 35 36 37 39 40 41 42 43 44] not in index'
---------------------------------------------------------------------------
KeyError回溯(最近一次呼叫最后一次)
在()
3.
4#使用train()和validate()方法运行分析并执行跨数据集预测。
---->5 ccaCV.列车([TCIA_列车,TCGA_列车],错误)
6 testcorrsCV=ccaCV.validate([TCIA_测试,TCGA_测试])
~/pycharm项目/论文代码/论文代码/软件包/rcca.py列车内(自我、数据、并行)
171 kernelcca=self.kernelcca,ktype=self.ktype,
172高斯马=self.gausigma,度=self.degree,
-->173切断=自切断,选择=选择)
174运行\u corr\u平均值\u总和+=折叠\u corr\u平均值
175
~/pycharm项目/论文代码/论文代码/软件包/rcca.py序列折叠(数据、注册、numCC、核心CCA、ktype、高斯码、学位、截止、选择)
202表示块中的ind]
203 notheldinds=列表(集合(范围(nT))-集合(heldinds))
-->204 comps=kcca([d[notheldinds]表示数据中的d],reg,numCC,
205 kernelcca=kernelcca,ktype=ktype,
206高斯马=高斯马,度=度)
~/PycharmProjects/thesis_code/thesis_code/Packages/rcca.py in(.0)
202表示块中的ind]
203 notheldinds=列表(集合(范围(nT))-集合(heldinds))
-->204 comps=kcca([d[notheldinds]表示数据中的d],reg,numCC,
205 kernelcca=kernelcca,ktype=ktype,
206高斯马=高斯马,度=度)
~/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py in\uuuuu getitem\uuuuu(self,key)
2131如果isinstance(键,(序列,np.ndarray,索引,列表)):
2132#布尔或奇异整数索引
->2133返回self.\u getitem\u数组(键)
2134 elif isinstance(键,数据帧):
2135返回自我。\u获取项目\u帧(键)
_getitem_数组中的~/anaconda3/lib/python3.6/site-packages/pandas/core/frame.py(self,key)
2175返回自取(索引器,轴=0,转换=False)
2176其他:
->2177索引器=self.loc.\u转换为索引器(键,轴=1)
2178返回自取(索引器,轴=1,转换=True)
2179
~/anaconda3/lib/python3.6/site-packages/pandas/core/index.py in\u convert\u to\u indexer(self、obj、axis、is\u setter)
1267如果掩码为.any():
1268 raise KeyError(“{mask}不在索引中”
->格式(mask=objarr[mask]))
1270
1271从对象(索引器)返回值
KeyError:“[0 1 2 4 5 6 7 8 9 10 11 12 13 14 15 18 20 22 23 24 26 27\n 28 30 34 35 37 39 40 41 42 44]不在索引中”
我想知道“\n”是否是一个问题?我已经用最新的错误日志更新了错误日志。
pyrca
看起来还不像是一个广为使用和知名的库,因此您在GitHub上可能比在这里询问更幸运。在任何一种情况下,请提供一个示例,并找出这是特定于您的自定义输入代码,还是在密切遵循教程时也会发生。如果是前者,请尝试找出仍然触发错误的与教程的最小偏差。