BaseGenerator featureGen = new BaseGenerator();
ZeroOneLoss loss = new ZeroOneLoss();
Inferencer msolver = new MultiLinearMax(featureGen, lf, null,2);
PATrainer trainer = new PATrainer(msolver, featureGen, loss, round,c, null);
Linear pclassifier = trainer.train(trainset, null);
String modelFile = "./tmp/m.gz";
pclassifier.saveTo(modelFile);
pclassifier = null;
System.out.println("分类器测试");
pclassifier = Linear.loadFrom(modelFile);
float[] tdata = new float[]{1,0,1};
ISparseVector sv = new HashSparseVector(tdata,true);
Instance inst = new Instance(sv);
String lab = pclassifier.getStringLabel(inst);
System.out.println("分类结果:\t"+lab);
long end = System.currentTimeMillis();
System.out.println("Total Time: " + (end - start));