@@ -0,0 +1,2583 @@
+package edu.neu.ccs.pyramid.experiment;%0A%0Aimport edu.neu.ccs.pyramid.classification.ClassifierFactory;%0Aimport edu.neu.ccs.pyramid.classification.TrainConfig;%0Aimport edu.neu.ccs.pyramid.classification.boosting.lktb.LKTBFactory;%0Aimport edu.neu.ccs.pyramid.classification.boosting.lktb.LKTBTrainConfig;%0Aimport edu.neu.ccs.pyramid.classification.ecoc.CodeMatrix;%0Aimport edu.neu.ccs.pyramid.classification.ecoc.ECOC;%0Aimport edu.neu.ccs.pyramid.classification.ecoc.ECOCConfig;%0Aimport edu.neu.ccs.pyramid.configuration.Config;%0Aimport edu.neu.ccs.pyramid.dataset.ClfDataSet;%0Aimport edu.neu.ccs.pyramid.dataset.DataSetType;%0Aimport edu.neu.ccs.pyramid.dataset.TRECFormat;%0Aimport edu.neu.ccs.pyramid.eval.Accuracy;%0A%0Aimport java.io.File;%0A%0A/**%0A * Created by chengli on 10/5/14.%0A */%0Apublic class Exp10 %7B%0A    public static void main(String%5B%5D args) throws Exception%7B%0A        if (args.length !=1)%7B%0A            throw new IllegalArgumentException(%22please specify the config file%22);%0A        %7D%0A%0A        Config config = new Config(args%5B0%5D);%0A        System.out.println(config);%0A        train(config);%0A        test(config);%0A    %7D%0A%0A    private static void train(Config config) throws Exception%7B%0A        String folder = config.getString(%22input.folder%22);%0A        File data = new File(folder,config.getString(%22input.trainData%22));%0A        ClfDataSet dataSet = TRECFormat.loadClfDataSet(data, DataSetType.CLF_DENSE,true);%0A        ClassifierFactory classifierFactory = new LKTBFactory();%0A        TrainConfig trainConfig = new LKTBTrainConfig()%0A                .setNumLeaves(2)%0A                .setLearningRate(0.1)%0A                .setNumIterations(200);%0A        ECOCConfig ecocConfig = new ECOCConfig().setCodeType(CodeMatrix.CodeType.RANDOM)%0A                .setNumFunctions(20);%0A        ECOC ecoc = new ECOC(ecocConfig,%0A                dataSet,%0A                new File(config.getString(%22archive%22),%22ecoc/models%22).getAbsolutePath(),%0A                classifierFactory,%0A                trainConfig);%0A        System.out.println(ecoc.getCodeMatrix().toString());%0A        ecoc.train();%0A        ecoc.serialize(new File(config.getString(%22archive%22),%22ecoc/ecoc.ser%22));%0A    %7D%0A%0A    private static void test(Config config) throws Exception%7B%0A        String folder = config.getString(%22input.folder%22);%0A        File data = new File(folder,config.getString(%22input.testData%22));%0A        ClfDataSet dataSet = TRECFormat.loadClfDataSet(data, DataSetType.CLF_DENSE,true);%0A        ECOC ecoc = ECOC.deserialize(new File(config.getString(%22archive%22),%22ecoc/ecoc.ser%22));%0A        System.out.println(Accuracy.accuracy(ecoc,dataSet));%0A    %7D%0A%0A%7D%0A

add exp10