Package ivory.regression.sigir2011

Source Code of ivory.regression.sigir2011.Wt10g_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 Wt10g_VaryingTradeoff_FeaturePrune {
  private static final Logger LOG = Logger.getLogger(Wt10g_VaryingTradeoff_FeaturePrune.class);

  private static String[] p1 = new String[] {
      "501", "0.3436", "502", "0.3493", "503", "0.1164", "504", "0.7549", "505", "0.3805",
      "506", "0.1065", "507", "0.5075", "508", "0.4076", "509", "0.5365", "510", "0.8958",
      "511", "0.5016", "512", "0.2170", "513", "0.0435", "514", "0.2926", "515", "0.2575",
      "516", "0.0780", "517", "0.1398", "518", "0.3797", "519", "0.2807", "520", "0.1995",
      "521", "0.2978", "522", "0.4562", "523", "0.3672", "524", "0.0819", "525", "0.2267",
      "526", "0.0762", "527", "0.7536", "528", "0.8213", "529", "0.4671", "530", "0.5008",
      "531", "0.2276", "532", "0.5110", "533", "0.8196", "534", "0.0401", "535", "0.0369",
      "536", "0.2756", "537", "0.0837", "538", "0.5110", "539", "0.4368", "540", "0.1964",
      "541", "0.4612", "542", "0.0279", "543", "0.1420", "544", "0.5066", "545", "0.4311",
      "546", "0.2232", "547", "0.2189", "548", "0.6053", "549", "0.4743", "550", "0.3614" };

  private static String[] p3 = new String[] {
      "501", "0.3436", "502", "0.3493", "503", "0.1164", "504", "0.7549", "505", "0.3805",
      "506", "0.1065", "507", "0.5075", "508", "0.4076", "509", "0.5365", "510", "0.8958",
      "511", "0.4735", "512", "0.2170", "513", "0.0435", "514", "0.2926", "515", "0.2575",
      "516", "0.0780", "517", "0.1398", "518", "0.3797", "519", "0.2807", "520", "0.1995",
      "521", "0.2978", "522", "0.4562", "523", "0.3672", "524", "0.0819", "525", "0.2267",
      "526", "0.0762", "527", "0.7536", "528", "0.8213", "529", "0.4671", "530", "0.5008",
      "531", "0.2276", "532", "0.5110", "533", "0.8196", "534", "0.0401", "535", "0.0369",
      "536", "0.2756", "537", "0.0837", "538", "0.5110", "539", "0.4368", "540", "0.1964",
      "541", "0.4612", "542", "0.0279", "543", "0.1420", "544", "0.5066", "545", "0.4311",
      "546", "0.2232", "547", "0.2189", "548", "0.6053", "549", "0.4743", "550", "0.3614" };

  private static String[] p5 = new String[] {
      "501", "0.3436", "502", "0.3493", "503", "0.1164", "504", "0.7549", "505", "0.3805",
      "506", "0.1065", "507", "0.5075", "508", "0.4076", "509", "0.5365", "510", "0.8958",
      "511", "0.4735", "512", "0.2170", "513", "0.0435", "514", "0.2926", "515", "0.2575",
      "516", "0.0780", "517", "0.1398", "518", "0.3797", "519", "0.2807", "520", "0.1995",
      "521", "0.2978", "522", "0.4562", "523", "0.3672", "524", "0.0819", "525", "0.2267",
      "526", "0.0762", "527", "0.7536", "528", "0.8213", "529", "0.4671", "530", "0.5008",
      "531", "0.2276", "532", "0.5110", "533", "0.8196", "534", "0.0401", "535", "0.0369",
      "536", "0.2756", "537", "0.0837", "538", "0.5110", "539", "0.4368", "540", "0.1964",
      "541", "0.4612", "542", "0.0279", "543", "0.1420", "544", "0.5066", "545", "0.4311",
      "546", "0.2232", "547", "0.2189", "548", "0.6053", "549", "0.4743", "550", "0.3614" };

  private static String[] p7 = new String[] {
      "501", "0.3436", "502", "0.3493", "503", "0.1164", "504", "0.7549", "505", "0.3805",
      "506", "0.1065", "507", "0.5075", "508", "0.2019", "509", "0.5365", "510", "0.8958",
      "511", "0.4735", "512", "0.2170", "513", "0.0435", "514", "0.2926", "515", "0.4027",
      "516", "0.0780", "517", "0.1398", "518", "0.3797", "519", "0.2807", "520", "0.1995",
      "521", "0.2978", "522", "0.4562", "523", "0.3672", "524", "0.0819", "525", "0.2267",
      "526", "0.0762", "527", "0.7536", "528", "0.8213", "529", "0.4671", "530", "0.5008",
      "531", "0.2276", "532", "0.5110", "533", "0.6813", "534", "0.0401", "535", "0.0369",
      "536", "0.2756", "537", "0.0837", "538", "0.5110", "539", "0.4368", "540", "0.1964",
      "541", "0.4612", "542", "0.0279", "543", "0.1420", "544", "0.5066", "545", "0.4311",
      "546", "0.2232", "547", "0.2189", "548", "0.6241", "549", "0.4743", "550", "0.3614" };

  private static String[] p9 = new String[] {
      "501", "0.3436", "502", "0.2568", "503", "0.1164", "504", "0.7549", "505", "0.3805",
      "506", "0.1065", "507", "0.5075", "508", "0.2019", "509", "0.5365", "510", "0.8114",
      "511", "0.4735", "512", "0.2170", "513", "0.0435", "514", "0.2926", "515", "0.4027",
      "516", "0.0780", "517", "0.1398", "518", "0.3797", "519", "0.2807", "520", "0.1995",
      "521", "0.2978", "522", "0.4332", "523", "0.3672", "524", "0.0819", "525", "0.2267",
      "526", "0.0762", "527", "0.7536", "528", "0.8213", "529", "0.4671", "530", "0.5008",
      "531", "0.2276", "532", "0.5110", "533", "0.6813", "534", "0.0401", "535", "0.0369",
      "536", "0.2756", "537", "0.0837", "538", "0.5110", "539", "0.4368", "540", "0.1964",
      "541", "0.4612", "542", "0.0279", "543", "0.1420", "544", "0.5066", "545", "0.404",
      "546", "0.2506", "547", "0.2189", "548", "0.6241", "549", "0.4743", "550", "0.3614" };

  @Test
  public void runRegression() throws Exception {
    Map<String, GroundTruth> g = Maps.newHashMap();
    g.put("Wt10g-FeaturePrune-0.1",
        new GroundTruth("Wt10g-FeaturePrune-0.1", Metric.NDCG20, 50, p1, 0.3486f));
    g.put("Wt10g-FeaturePrune-0.3",
        new GroundTruth("Wt10g-FeaturePrune-0.3", Metric.NDCG20, 50, p3, 0.3480f));
    g.put("Wt10g-FeaturePrune-0.5",
        new GroundTruth("Wt10g-FeaturePrune-0.5", Metric.NDCG20, 50, p5, 0.3480f));
    g.put("Wt10g-FeaturePrune-0.7",
        new GroundTruth("Wt10g-FeaturePrune-0.7", Metric.NDCG20, 50, p7, 0.3444f));
    g.put("Wt10g-FeaturePrune-0.9",
        new GroundTruth("Wt10g-FeaturePrune-0.9", Metric.NDCG20, 50, p9, 0.3404f));

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

    String[] params = new String[] {
        "data/wt10g/run.wt10g.SIGIR2011.varying.tradeoff.featureprune.xml",
        "data/wt10g/queries.wt10g.501-550.xml" };

    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(Wt10g_VaryingTradeoff_FeaturePrune.class);
  }
}
TOP

Related Classes of ivory.regression.sigir2011.Wt10g_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.