小编sch*_*ler的帖子

从 dask 读取并行 excel 表

您好,到目前为止,我遇到的使用 dask 的所有示例都是使用 dask read_csv 调用读取文件夹中的多个 csv 文件。

如果我提供了一个包含多个选项卡的 xlsx 文件,我可以使用 dask 中的任何内容来并行读取它们吗?

PS我使用 pandas 0.19.2 和 python 2.7

python-2.7 dask

5
推荐指数
2
解决办法
1万
查看次数

使用 scikit 学习重建错误分析的快速 ICA

我正在尝试fastICA在 scikitLearn 中使用过程。出于验证目的,我试图了解PCAICA基于信号重建之间的区别。

原始观测信号数为 6,我尝试使用 3 个重构独立分量。问题是,无论是ICAPCA导致相同的重建误差不管是什么标准我使用。有人可以了解这里发生的事情吗?

代码如下:

 pca = PCA(n_components=3)
 icamodel = FastICA(n_components=3,whiten=True)

 Data = TrainingDataDict[YearSpan][RiskFactorNames]

 PCR_Dict[YearSpan] = pd.DataFrame(pca.fit_transform(Data), 
                                   columns=['PC1','PC2','PC3'],index=Data.index)

 ICR_Dict[YearSpan] = pd.DataFrame(icamodel.fit_transform(Data), 
                                   columns=['IC1','IC2','IC3'],index=Data.index)

'------------------------Inverse Transform of the IC and PCs -----------'

 PCA_New_Data_Df = pd.DataFrame(pca.inverse_transform(PCR_Dict[YearSpan]),
                                   columns =['F1','F2','F3'],index = Data.index)

 ICA_New_Data_Df = pd.DataFrame(icamodel.inverse_transform(ICR_Dict[YearSpan]),
                                   columns =['F1','F2','F3'],index = Data.index)
Run Code Online (Sandbox Code Playgroud)

下面是我测量重建误差的方法

'-----------reconstruction errors------------------'
 print 'PCA reconstruction error L2 norm:',np.sqrt((PCA_New_Data_Df - Data).apply(np.square).mean())

 print 'ICA reconstruction error L2 norm:',np.sqrt((ICA_New_Data_Df - Data).apply(np.square).mean())

 print 'PCA reconstruction error …
Run Code Online (Sandbox Code Playgroud)

machine-learning pca dimensionality-reduction scikit-learn

5
推荐指数
1
解决办法
1914
查看次数