2017-06-15 34 views
0

我用Mallet训练了一个maxent文档分类模型,结果是130MB,这对于我希望运行它的实例来说太大了。我想知道是否有办法潜在地减少模型的词汇量,从而减少整体模型的大小。有这样做的管道吗?我目前使用的管道是Mallet文档分类 - 缩小词汇大小

Pipe instancePipe = new SerialPipes(new Pipe[]{ 
      new Target2Label(),      //creates labels 
      new Input2CharSequence("UTF-8"),  //read the file as string 
      new CharSequence2TokenSequence(),  //tokenize the string 
      new TokenSequenceLowercase(),   //lowercase the tokens 
      new TokenSequenceRemoveStopwords(false), //remove stopwords 
      new TokenSequence2FeatureSequence(), //convert tokens to features 
      new FeatureSequence2FeatureVector(), //create feature vector 
      //new PrintInputAndTarget() //print everything 
    }); 

任何其他提示以减少模型的大小也将是有益的

回答

1

最简单的方法是尝试你的初始导入后修剪的词汇。使用

bin/mallet prune --help 

查看选项。