资源简介
CRF_maxent.rar 东北大学张乐博士的最大熵工具包 很好的资料
代码片段和文件信息
package iitb.CRFAppl;
import iitb.CRF.*;
import iitb.Model.*;
import iitb.Utils.*;
...;
public class CRFAppl {
Properties options;
CRF crfModel;
FeatureGenImpl featureGen;
public static void main(String argv[]) throws Exception {
/*
* Initialization:
* Get the required arguements for the application here.
* Also you will need to create a Properties object for arguements to be
* passed to the CRF. You do not need to worry about this object
* because there are default values for all the parameters in the CRF package.
* You may need to pass your own parameters values for tuning the application
* performance.
*/
/*
* There are mainly two phases for a learning application: Training and Testing.
* Implement two routines for each of the phases and call them appropriately here.
*/
train();
test();
}
public void train() throws Exception {
/*
* Read the training dataset into an object which implements DataIter
* interface(trainData). Each of the training instance is encapsulated in the
* object which provides DataSequence interface. The DataIter interface
* returns object of DataSequence (training instance) in next() routine.
*/
/*
* Once you have loaded the training dataset you need to allocate objects
* for the model to be learned. allocmodel() method does that allocation.
*/
allocModel();
/*
* You may need to train some of the feature types class. This training is
* needed for features which need to learn from the training data for instance
* dictionary features build generated from the training set.
*/
featureGen.train(trainData);
/*
* Call train routine of the CRF model to train the model using the
* train data. This routine returns the learned weight for the features.
*/
double featureWts[] = crfModel.train(trainData);
/*
* You can store the learned model for later use into disk.
* For this you will have to store features as well as their
* corresponding weights.
*/
crfModel.write(baseDir+“/learntModels/“+outDir+“/crf“);
featureGen.write(baseDir+“/learntModels/“+outDir+“/features“);
}
public void test() throws Exception {
/*
* Read the test dataset. Each of the test instance is encapsulated in the
* object which provides DataSequence interface.
*/
/*
* Once you have loaded the test dataset you need to allocate objects
* for the model to be learned. allocmodel() method does that allocation.
* Also you need to read learned parameters from the disk stored after
* training. If the model is already available in the memory then you do
* not need to reallocate the model i.e. you can skip the next step in that
* case.
*/
allocModel();
featureGen.read(baseDir+“/learntModels/“+outD
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 200 2005-05-25 15:10 CRF\build\iitb\CRF\CandidateSegments.class
文件 303 2005-05-25 15:10 CRF\build\iitb\CRF\CandSegDataSequence.class
文件 5867 2005-05-25 15:10 CRF\build\iitb\CRF\CollinsTrainer.class
文件 251 2005-05-25 15:10 CRF\build\iitb\CRF\Constraint.class
文件 231 2005-05-25 15:10 CRF\build\iitb\CRF\ConstraintDisallowedPairs.class
文件 4892 2005-05-25 15:10 CRF\build\iitb\CRF\CRF.class
文件 2669 2005-05-25 15:10 CRF\build\iitb\CRF\CrfParams.class
文件 199 2005-05-25 15:10 CRF\build\iitb\CRF\DataIter.class
文件 216 2005-05-25 15:10 CRF\build\iitb\CRF\DataSequence.class
文件 1012 2005-05-25 15:10 CRF\build\iitb\CRF\EdgeGenerator.class
文件 133 2005-05-25 15:10 CRF\build\iitb\CRF\Evaluator.class
文件 204 2005-05-25 15:10 CRF\build\iitb\CRF\Feature.class
文件 1165 2005-05-25 15:10 CRF\build\iitb\CRF\FeatureGenCache$FeatureImpl.class
文件 4393 2005-05-25 15:10 CRF\build\iitb\CRF\FeatureGenCache.class
文件 346 2005-05-25 15:10 CRF\build\iitb\CRF\FeatureGenerator.class
文件 254 2005-05-25 15:10 CRF\build\iitb\CRF\FeatureGeneratorNested.class
文件 1179 2005-05-25 15:10 CRF\build\iitb\CRF\HistoryManager$DataIterHistory.class
文件 1419 2005-05-25 15:10 CRF\build\iitb\CRF\HistoryManager$DataSequenceHist.class
文件 1979 2005-05-25 15:10 CRF\build\iitb\CRF\HistoryManager$FeatureGeneratorWithHistory.class
文件 2384 2005-05-25 15:10 CRF\build\iitb\CRF\HistoryManager$FeatureHist.class
文件 1740 2005-05-25 15:10 CRF\build\iitb\CRF\HistoryManager.class
文件 2498 2005-05-25 15:10 CRF\build\iitb\CRF\LogDenseDoubleMatrix1D.class
文件 1484 2005-05-25 15:10 CRF\build\iitb\CRF\LogDenseDoubleMatrix2D.class
文件 2513 2005-05-25 15:10 CRF\build\iitb\CRF\LogSparseDoubleMatrix1D.class
文件 779 2005-05-25 15:10 CRF\build\iitb\CRF\LogSparseDoubleMatrix1DOld$DoubleDoubleFunctionWrapper.class
文件 3627 2005-05-25 15:10 CRF\build\iitb\CRF\LogSparseDoubleMatrix1DOld.class
文件 1488 2005-05-25 15:10 CRF\build\iitb\CRF\LogSparseDoubleMatrix2D.class
文件 1041 2005-05-25 15:10 CRF\build\iitb\CRF\NestedCollinsTrainer.class
文件 2355 2005-05-25 15:10 CRF\build\iitb\CRF\NestedCRF.class
文件 10304 2005-05-25 15:10 CRF\build\iitb\CRF\NestedTrainer.class
............此处省略380个文件信息
- 上一篇:gslib90地统计软件
- 下一篇:高校计算机联合考试(广西考区)一级(共10套)
评论
共有 条评论