People love dealing with well-structured data. It costs much less efforts than working with disorganized raw texts.
In economic and financial research, we typically download data from open-access websites or authentication-required databases. These sources may provide data in multiple formats. For example, almost all 继续阅读 »
1. failed to write data to stream
环境:ipython, OSX
操作:在ipython里import 一个pure module
问题: Python - ERROR - failed to write data to stream: ', mode 'w' at 0x104c8f150>
办法:export PYTHONIOENCODING=UTF-8 will solve it.
相关:stackoverflow继续阅读 »
R rocks in both academia and industry nowadays. A rapidly increasing number of researchers choose R to be one of their productive tools for data analysis and data visualization. It is partially because the software is totally free and open-source but also because the community behind the stage who contributes to nearly继续阅读 »
Version:Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32
文件与I/O
读写文本数据
使用带有rt模式的open()函数读取文本文件
```python
with open('test.csv', mode='rt', encoding='utf-8') as f:
data = f.read()
print(data)
with open('test.csv', mode='rt', encoding='utf-8') as f:
for line in继续阅读 »
训练阶段我们采用了分批处理,可以优化部分内存。
原先我们的代码使用一次性载入数据,然后开始若干次迭代,直至收敛。这样保存image与shape的数据矩阵Data就一直占用内存,但实际上,数据集的image与shape 的作用仅仅是计算$\Delta X$和$\Phi$,两变量的定义参考《 Supervised Descent Method and its Applications to Face Alignment》,其实也就是init shape与true shape的差值以及init shape的特征向量。计算完了,Data就没用了。于是我们设想分批处理,每次迭代载入一次数据,用完了就clear。这样就需要载入多次,可能时间上继续阅读 »