2013年7月19日星期五

使用maxent zhang le

1) 下载
git clone https://github.com/lzhang10/maxent.git

2) 安装
按照INSTALL说明, 依次安装
$ brew install gfortran  (需要先安装howbrew (ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"), 见http://mxcl.github.io/homebrew/)

$./configure

$make

$make install

3) 使用, 在eclipse中,


#include "maxent/maxentmodel.hpp"
MaxentModel *pModel = new MaxentModel();
pModel->begin_add_event();
.....
pModel->add_event(vecContext, p, 1);
.....
pModel->end_add_event();
pModel->train(100, "lbfgs"); // train the model with 30 iterations of L-BFGS method

编译时在link这一步会提示关于gfortran的错误
需要在Properties属性中添加linker libraries (-l): gfortan, 以及linker libraries path: /usr/local/Cellar/gfortran/4.8.1/gfortran/lib


没有评论: