INNER CODE UNIT · Java
main
mayabot/mynlp · mynlp-example/src/main/java/classification/HotelCommentExampleTrain.java:21
public static void main(String[] args) throws Exception {
prepare();
File trainFile = new File("example.data/hotel/hotel-train-seg.txt");
File testFile = new File("example.data/hotel/hotel-test-seg.txt");
InputArgs trainArgs = new InputArgs();
trainArgs.setLoss(LossName.hs);
trainArgs.setEpoch(10);
trainArgs.setDim(100);
trainArgs.setLr(0.2);
FastText fastText = FastText.trainSupervised(trainFile, trainArgs);
fastText.test(testFile, 1, 0.0f, true);
// 乘积量化压缩模型和测试