Package ivory.regression.sigir2011

Source Code of ivory.regression.sigir2011.Gov2_VaryingTradeoff_FeaturePrune

package ivory.regression.sigir2011;

import ivory.cascade.retrieval.CascadeBatchQueryRunner;
import ivory.core.eval.GradedQrels;
import ivory.regression.GroundTruth;
import ivory.regression.GroundTruth.Metric;
import ivory.smrf.retrieval.Accumulator;

import java.util.Map;

import junit.framework.JUnit4TestAdapter;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.log4j.Logger;
import org.junit.Test;

import com.google.common.collect.Maps;

public class Gov2_VaryingTradeoff_FeaturePrune {
  private static final Logger LOG = Logger.getLogger(Gov2_VaryingTradeoff_FeaturePrune.class);

  private static String[] p1 = new String[] {
      "776", "0.2680", "777", "0.1257", "778", "0.4791", "779", "0.9087", "780", "0.4601",
      "781", "0.5673", "782", "0.5214", "783", "0.4787", "784", "0.7574", "785", "0.8446",
      "786", "0.2088", "787", "0.8758", "788", "0.7909", "789", "0.3502", "790", "0.8563",
      "791", "0.6110", "792", "0.2369", "793", "0.5467", "794", "0.4725", "795", "0.0000",
      "796", "0.3535", "797", "0.2122", "798", "0.1414", "799", "0.3632", "800", "0.1413",
      "801", "0.5867", "802", "0.9572", "803", "0.0000", "804", "0.4972", "805", "0.1564",
      "806", "0.5721", "807", "0.9393", "808", "0.9549", "809", "0.3055", "810", "0.4375",
      "811", "0.5875", "812", "0.7242", "813", "0.7551", "814", "0.7059", "815", "0.1877",
      "816", "0.5724", "817", "0.9046", "818", "0.4776", "819", "0.9239", "820", "0.7114",
      "821", "0.2575", "822", "0.1366", "823", "0.6292", "824", "0.3156", "825", "0.1378",
      "826", "0.4913", "827", "0.5058", "828", "0.5376", "829", "0.4397", "830", "0.3218",
      "831", "0.7272", "832", "0.5761", "833", "0.3533", "834", "0.5356", "835", "0.7072",
      "836", "0.1959", "837", "0.0000", "838", "0.6889", "839", "0.6344", "840", "0.1744",
      "841", "0.5466", "842", "0.1061", "843", "0.6907", "844", "0.1686", "845", "0.2825",
      "846", "0.4780", "847", "0.0472", "848", "0.1480", "849", "0.6821", "850", "0.3229" };

  private static String[] p3 = new String[] {
      "776", "0.2503", "777", "0.1257", "778", "0.4791", "779", "0.9087", "780", "0.4430",
      "781", "0.5673", "782", "0.5214", "783", "0.4787", "784", "0.7574", "785", "0.8446",
      "786", "0.2088", "787", "0.8758", "788", "0.7909", "789", "0.3502", "790", "0.7095",
      "791", "0.6110", "792", "0.2088", "793", "0.5467", "794", "0.4725", "795", "0.0000",
      "796", "0.3535", "797", "0.2122", "798", "0.1414", "799", "0.3632", "800", "0.1413",
      "801", "0.5867", "802", "0.9627", "803", "0.0000", "804", "0.5225", "805", "0.1564",
      "806", "0.5721", "807", "0.9393", "808", "0.9393", "809", "0.3055", "810", "0.4375",
      "811", "0.5875", "812", "0.7242", "813", "0.7525", "814", "0.7059", "815", "0.1877",
      "816", "0.5724", "817", "0.9046", "818", "0.4776", "819", "0.9239", "820", "0.7114",
      "821", "0.2575", "822", "0.1366", "823", "0.6743", "824", "0.3156", "825", "0.1378",
      "826", "0.4913", "827", "0.5058", "828", "0.5376", "829", "0.4397", "830", "0.3218",
      "831", "0.4402", "832", "0.5761", "833", "0.3533", "834", "0.5356", "835", "0.7072",
      "836", "0.2155", "837", "0.0000", "838", "0.6889", "839", "0.6344", "840", "0.1744",
      "841", "0.5466", "842", "0.1061", "843", "0.6907", "844", "0.1686", "845", "0.2825",
      "846", "0.4780", "847", "0.0472", "848", "0.1480", "849", "0.6821", "850", "0.3289" };

  private static String[] p5 = new String[] {
      "776", "0.2503", "777", "0.1257", "778", "0.4791", "779", "0.9087", "780", "0.4430",
      "781", "0.5673", "782", "0.5214", "783", "0.4787", "784", "0.7574", "785", "0.8446",
      "786", "0.2088", "787", "0.8758", "788", "0.7522", "789", "0.3502", "790", "0.7095",
      "791", "0.6110", "792", "0.2088", "793", "0.5467", "794", "0.4725", "795", "0.0000",
      "796", "0.3535", "797", "0.2122", "798", "0.1414", "799", "0.3632", "800", "0.1413",
      "801", "0.5867", "802", "0.9627", "803", "0.0000", "804", "0.5225", "805", "0.1564",
      "806", "0.5721", "807", "0.9393", "808", "0.9393", "809", "0.3055", "810", "0.4375",
      "811", "0.5875", "812", "0.7242", "813", "0.7525", "814", "0.7059", "815", "0.1877",
      "816", "0.5724", "817", "0.9046", "818", "0.4776", "819", "0.9239", "820", "0.7309",
      "821", "0.2575", "822", "0.1366", "823", "0.6743", "824", "0.3156", "825", "0.1378",
      "826", "0.4913", "827", "0.5058", "828", "0.5376", "829", "0.4397", "830", "0.3218",
      "831", "0.4402", "832", "0.5761", "833", "0.3533", "834", "0.5356", "835", "0.7072",
      "836", "0.2155", "837", "0.0000", "838", "0.6889", "839", "0.6344", "840", "0.1744",
      "841", "0.5466", "842", "0.1061", "843", "0.6907", "844", "0.1686", "845", "0.2825",
      "846", "0.4780", "847", "0.0472", "848", "0.2901", "849", "0.6821", "850", "0.3289" };

  private static String[] p7 = new String[] {
      "776", "0.2503", "777", "0.2199", "778", "0.4465", "779", "0.9087", "780", "0.4430",
      "781", "0.1535", "782", "0.4378", "783", "0.5223", "784", "0.7574", "785", "0.6816",
      "786", "0.4783", "787", "0.8758", "788", "0.7522", "789", "0.3502", "790", "0.7095",
      "791", "0.5934", "792", "0.2088", "793", "0.5467", "794", "0.1336", "795", "0.0000",
      "796", "0.4703", "797", "0.2828", "798", "0.1414", "799", "0.3934", "800", "0.1413",
      "801", "0.5912", "802", "0.9677", "803", "0.0000", "804", "0.5225", "805", "0.1564",
      "806", "0.5721", "807", "0.8917", "808", "0.9393", "809", "0.2694", "810", "0.4375",
      "811", "0.5726", "812", "0.8090", "813", "0.8975", "814", "0.7010", "815", "0.1250",
      "816", "0.5724", "817", "0.7799", "818", "0.4596", "819", "0.9821", "820", "0.7109",
      "821", "0.3232", "822", "0.2268", "823", "0.6743", "824", "0.3156", "825", "0.1389",
      "826", "0.4360", "827", "0.6028", "828", "0.4339", "829", "0.2159", "830", "0.2912",
      "831", "0.7033", "832", "0.5761", "833", "0.5925", "834", "0.5989", "835", "0.0334",
      "836", "0.2155", "837", "0.0000", "838", "0.6889", "839", "0.5399", "840", "0.1744",
      "841", "0.5466", "842", "0.1059", "843", "0.6511", "844", "0.0610", "845", "0.3358",
      "846", "0.4780", "847", "0.0472", "848", "0.2901", "849", "0.5620", "850", "0.3289" };

  private static String[] p9 = new String[] {
      "776", "0.2297", "777", "0.2168", "778", "0.4434", "779", "0.8263", "780", "0.4392",
      "781", "0.4249", "782", "0.4546", "783", "0.4763", "784", "0.7317", "785", "0.6622",
      "786", "0.4232", "787", "0.7718", "788", "0.7537", "789", "0.3516", "790", "0.8054",
      "791", "0.6629", "792", "0.2104", "793", "0.3758", "794", "0.1348", "795", "0.0000",
      "796", "0.3863", "797", "0.4616", "798", "0.2733", "799", "0.2142", "800", "0.1414",
      "801", "0.5912", "802", "0.7735", "803", "0.0000", "804", "0.3930", "805", "0.0844",
      "806", "0.1293", "807", "0.8668", "808", "0.9990", "809", "0.2584", "810", "0.3086",
      "811", "0.4901", "812", "0.8090", "813", "0.8941", "814", "0.7003", "815", "0.1236",
      "816", "0.7040", "817", "0.8519", "818", "0.3939", "819", "0.9821", "820", "0.7109",
      "821", "0.2099", "822", "0.2279", "823", "0.6743", "824", "0.3156", "825", "0.1251",
      "826", "0.4355", "827", "0.6512", "828", "0.4171", "829", "0.2689", "830", "0.1837",
      "831", "0.8051", "832", "0.5456", "833", "0.6858", "834", "0.5333", "835", "0.0652",
      "836", "0.1825", "837", "0.0306", "838", "0.6537", "839", "0.5113", "840", "0.1744",
      "841", "0.5707", "842", "0.1059", "843", "0.6511", "844", "0.0619", "845", "0.3234",
      "846", "0.5646", "847", "0.4759", "848", "0.2927", "849", "0.5632", "850", "0.3406" };

  @Test
  public void runRegression() throws Exception {
    Map<String, GroundTruth> g = Maps.newHashMap();
    g.put("Gov2-FeaturePrune-0.9",
        new GroundTruth("Gov2-FeaturePrune-0.9", Metric.NDCG20, 75, p9, 0.4478f));
    g.put("Gov2-FeaturePrune-0.7",
        new GroundTruth("Gov2-FeaturePrune-0.7", Metric.NDCG20, 75, p7, 0.4539f));
    g.put("Gov2-FeaturePrune-0.5",
        new GroundTruth("Gov2-FeaturePrune-0.5", Metric.NDCG20, 75, p5, 0.4677f));
    g.put("Gov2-FeaturePrune-0.3",
        new GroundTruth("Gov2-FeaturePrune-0.3", Metric.NDCG20, 75, p3, 0.4661f));
    g.put("Gov2-FeaturePrune-0.1",
        new GroundTruth("Gov2-FeaturePrune-0.1", Metric.NDCG20, 75, p1, 0.4716f));

    GradedQrels qrels = new GradedQrels("data/gov2/qrels.gov2.all");

    String[] params = new String[] {
        "data/gov2/run.gov2.SIGIR2011.varying.tradeoff.featureprune.xml",
        "data/gov2/gov2.title.776-850" };

    FileSystem fs = FileSystem.getLocal(new Configuration());
    CascadeBatchQueryRunner qr = new CascadeBatchQueryRunner(params, fs);

    long start = System.currentTimeMillis();
    qr.runQueries();
    long end = System.currentTimeMillis();
    LOG.info("Total query time: " + (end - start) + "ms");

    for (String model : qr.getModels()) {
      LOG.info("Verifying results of model \"" + model + "\"");
      Map<String, Accumulator[]> results = qr.getResults(model);
      g.get(model).verify(results, qr.getDocnoMapping(), qrels);
      LOG.info("Done!");
    }
  }

  public static junit.framework.Test suite() {
    return new JUnit4TestAdapter(Gov2_VaryingTradeoff_FeaturePrune.class);
  }
}
TOP

Related Classes of ivory.regression.sigir2011.Gov2_VaryingTradeoff_FeaturePrune

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.