Package org.data2semantics.exp.utils

Examples of org.data2semantics.exp.utils.Result


    ResultsTable resTable = new ResultsTable();

    resTable.newRow("WL RDF");
    for (double frac : fractions) {

      Result res = new Result();
      res.setLabel("runtime");
      for (long seed : seeds) {

        createAffiliationPredictionDataSet(frac, seed);

        KernelExperiment<RDFGraphKernel> exp = new RDFKernelRunTimeExperiment(new ECML2013RDFWLSubTreeKernel(iteration, depth, inference, true, false), seeds, parms, dataset, instances, labels, blackList);

        System.out.println("Running WL RDF: " + frac);
        exp.run();
        res.addResult(exp.getResults().get(0));
      }
      resTable.addResult(res);
    }

    resTable.newRow("IST");
    for (double frac : fractions) {

      Result res = new Result();
      res.setLabel("runtime");
      for (long seed : seeds) {

        createAffiliationPredictionDataSet(frac, seed);

        KernelExperiment<RDFGraphKernel> exp = new RDFKernelRunTimeExperiment(new RDFIntersectionSubTreeKernel(depth, 1, inference, true, false), seeds, parms, dataset, instances, labels, blackList);

        System.out.println("Running IST: " + frac);
        exp.run();
        res.addResult(exp.getResults().get(0));
      }

      resTable.addResult(res);
    }


    long tic, toc;



    resTable.newRow("WL");
    for (double frac : fractions) {

      Result res = new Result();
      res.setLabel("runtime");
      for (long seed : seeds) {

        createAffiliationPredictionDataSet(frac,seed);
        tic = System.currentTimeMillis();
        PropertyPredictionDataSet ds = DataSetFactory.createPropertyPredictionDataSet(new GeneralPredictionDataSetParameters(dataset, blackLists, instances, 3, false, true));
        toc = System.currentTimeMillis();

        KernelExperiment<GraphKernel> exp = new GraphKernelRunTimeExperiment(new ECML2013WLSubTreeKernel(iteration), seeds, parms, ds.getGraphs(), labels);

        System.out.println("Running WL: " + frac);
        exp.run();
        res.addResult(exp.getResults().get(0));

        double[] comps = {2 * (toc-tic) + res.getScore()};
        Result resC = new Result(comps,"comp time 2")
        res.addResult(resC);
      }

      resTable.addResult(res);
    }
    /*
    resTable.newRow("");
    for (double frac : fractions) {
      createAffiliationPredictionDataSet(frac);
      tic = System.currentTimeMillis();
      PropertyPredictionDataSet ds = DataSetFactory.createPropertyPredictionDataSet(new GeneralPredictionDataSetParameters(dataset, blackLists, instances, 3, false, true));
      toc = System.currentTimeMillis();


      KernelExperiment<GraphKernel> exp = new GraphKernelExperiment(new ECML2013IntersectionGraphPathKernel(2,1), seeds, parms, ds.getGraphs(), labels);

      System.out.println("Running IGP: " + frac);
      exp.run();

      double[] comps =  {0,0};
  comps[0] = 2*(toc-tic) + exp.getResults().get(exp.getResults().size()-1).getScore();
      comps[1] = 2*(toc-tic) + exp.getResults().get(exp.getResults().size()-1).getScore();
          Result resC = new Result(comps,"comp time 2"); 
      exp.getResults().get(exp.getResults().size()-1).addResult(resC);

      resTable.addResult(exp.getResults().get(exp.getResults().size()-1));
    }*/


    resTable.newRow("IGW");
    for (double frac : fractions) {

      Result res = new Result();
      res.setLabel("runtime");
      for (long seed : seeds) {
        createAffiliationPredictionDataSet(frac,seed);
        tic = System.currentTimeMillis();
        PropertyPredictionDataSet ds = DataSetFactory.createPropertyPredictionDataSet(new GeneralPredictionDataSetParameters(dataset, blackLists, instances, 3, false, true));
        toc = System.currentTimeMillis();

        KernelExperiment<GraphKernel> exp = new GraphKernelRunTimeExperiment(new ECML2013IntersectionGraphWalkKernel(2,1), seeds, parms, ds.getGraphs(), labels);

        System.out.println("Running IGW: " + frac);
        exp.run();

        res.addResult(exp.getResults().get(0));

        double[] comps = {2 * (toc-tic) + res.getScore()};
        Result resC = new Result(comps,"comp time 2")
        res.addResult(resC);
      }

      resTable.addResult(res);
    }
View Full Code Here


        }

        double[] comps =  {0,0};
        comps[0] = toc-tic;
        comps[1] = toc-tic;
        Result resC = new Result(comps,"comp time 2");
        resTable.addResult(resC);

      }
    }
    saveResults(resTable, "affiliation.ser");



    /*
    dataSetsParams = new ArrayList<GeneralPredictionDataSetParameters>();

    dataSetsParams.add(new GeneralPredictionDataSetParameters(dataset, blackLists, instances, 1, false, false));
    dataSetsParams.add(new GeneralPredictionDataSetParameters(dataset, blackLists, instances, 2, false, false));

    dataSetsParams.add(new GeneralPredictionDataSetParameters(dataset, blackLists, instances, 1, false, true));
    dataSetsParams.add(new GeneralPredictionDataSetParameters(dataset, blackLists, instances, 2, false, true));
     */


    for (GeneralPredictionDataSetParameters params : dataSetsParams) {
      tic = System.currentTimeMillis();
      PropertyPredictionDataSet ds = DataSetFactory.createPropertyPredictionDataSet(params);
      toc = System.currentTimeMillis();

      if (blankLabels) {
        ds.removeVertexAndEdgeLabels();
      }

      resTable.newRow("IGP");
      for (int it : iterationsIG) {
        KernelExperiment<GraphKernel> exp = new GraphKernelExperiment(new ECML2013IntersectionGraphPathKernel(it,1), seeds, parms, ds.getGraphs(), labels);

        System.out.println("Running IGP: " + it);
        exp.run();

        for (Result res : exp.getResults()) {
          resTable.addResult(res);
        }

        double[] comps =  {0,0};
        comps[0] = toc-tic;
        comps[1] = toc-tic;
        Result resC = new Result(comps,"comp time 2");
        resTable.addResult(resC);
      }
    }
    saveResults(resTable, "affiliation.ser");


   
    for (GeneralPredictionDataSetParameters params : dataSetsParams) {
      tic = System.currentTimeMillis();
      PropertyPredictionDataSet ds = DataSetFactory.createPropertyPredictionDataSet(params);
      toc = System.currentTimeMillis();

      if (blankLabels) {
        ds.removeVertexAndEdgeLabels();
      }

      resTable.newRow("IGW");
      for (int it : iterationsIG) {
        KernelExperiment<GraphKernel> exp = new GraphKernelExperiment(new ECML2013IntersectionGraphWalkKernel(it,1), seeds, parms, ds.getGraphs(), labels);

        System.out.println("Running IGW: " + it);
        exp.run();

        for (Result res : exp.getResults()) {
          resTable.addResult(res);
        }

        double[] comps =  {0,0};
        comps[0] = toc-tic;
        comps[1] = toc-tic;
        Result resC = new Result(comps,"comp time 2");
        resTable.addResult(resC);

      }
    }
   
View Full Code Here

    this.evalFunctions = evalFunctions;
   
    resultMap = new HashMap<EvaluationFunction,double[]>();
   
    for (EvaluationFunction evalFunc : evalFunctions) {
      Result res = new Result();
      double[] resA = new double[seeds.length];
      res.setLabel(evalFunc.getLabel());
      res.setScores(resA);
      res.setHigherIsBetter(evalFunc.isHigherIsBetter());
      results.add(res);
      resultMap.put(evalFunc, resA);
    }
   
    compR = new Result();
    results.add(compR);
  }
View Full Code Here

      System.out.println("RDF WL FV: " + frac);
      tic = System.currentTimeMillis();
      k.computeFeatureVectors(dataset, instances, blackList);
      toc = System.currentTimeMillis();
      double[] comp = {toc-tic};
      Result res = new Result(comp, "comp time");
      resTable.addResult(res);
   
    System.out.println(resTable);
   
    resTable.newRow("WLRDF Kernel");
    for (double frac : fractions) {
      createGeoDataSet((int)(1000 * frac), frac, seed, "http://data.bgs.ac.uk/ref/Lexicon/hasUnitClass");   

      RDFGraphKernel k = new RDFWLSubTreeKernel(6,3,false, true);
     
      System.out.println("RDF WL Kernel: " + frac);
      tic = System.currentTimeMillis();
      k.compute(dataset, instances, blackList);
      toc = System.currentTimeMillis();
      double[] comp = {toc-tic};
      Result res = new Result(comp, "comp time");
      resTable.addResult(res);
   
    System.out.println(resTable);
   
    resTable.newRow("WLRDF String FV");
    for (double frac : fractions) {
      createGeoDataSet((int)(1000 * frac), frac, seed, "http://data.bgs.ac.uk/ref/Lexicon/hasUnitClass");   
      RDFFeatureVectorKernel k = new RDFWLSubTreeKernelString(6,3, false, true);
 
     
      System.out.println("RDF WL String FV: " + frac);
      tic = System.currentTimeMillis();
      k.computeFeatureVectors(dataset, instances, blackList);
      toc = System.currentTimeMillis();
      double[] comp = {toc-tic};
      Result res = new Result(comp, "comp time");
      resTable.addResult(res);
    }
    System.out.println(resTable);
   
    resTable.newRow("WLRDF String Kernel");
    for (double frac : fractions) {
      createGeoDataSet((int)(1000 * frac), frac, seed, "http://data.bgs.ac.uk/ref/Lexicon/hasUnitClass");   
      RDFGraphKernel k = new RDFWLSubTreeKernelString(6,3, false, true);
 
     
      System.out.println("RDF WL String: " + frac);
      tic = System.currentTimeMillis();
      k.compute(dataset, instances, blackList);
      toc = System.currentTimeMillis();
      double[] comp = {toc-tic};
      Result res = new Result(comp, "comp time");
      resTable.addResult(res);
    }
    System.out.println(resTable);
 
   
   
    resTable.newRow("RDF IST");
    for (double frac : fractions) {
      createGeoDataSet((int)(1000 * frac), frac, seed, "http://data.bgs.ac.uk/ref/Lexicon/hasUnitClass");   
      RDFGraphKernel k = new RDFIntersectionSubTreeKernel(3,1, false, true);
 
     
      System.out.println("RDF IST: " + frac);
      tic = System.currentTimeMillis();
      k.compute(dataset, instances, blackList);
      toc = System.currentTimeMillis();
      double[] comp = {toc-tic};
      Result res = new Result(comp, "comp time");
      resTable.addResult(res);
    }
    System.out.println(resTable);
   
   
   
   
    resTable.newRow("WL FV");
    for (double frac : fractionsSlow) {
      createGeoDataSet((int)(1000 * frac), frac, seed, "http://data.bgs.ac.uk/ref/Lexicon/hasUnitClass");   
      tic = System.currentTimeMillis();
      PropertyPredictionDataSet ds = DataSetFactory.createPropertyPredictionDataSet(new GeneralPredictionDataSetParameters(dataset, blackLists, instances, 3, false, true));
      toc = System.currentTimeMillis();
      double dsComp = toc-tic;
     
      FeatureVectorKernel k = new WLSubTreeKernel(6,true);
     
      System.out.println("WL: " + frac);
      tic = System.currentTimeMillis();
      k.computeFeatureVectors(ds.getGraphs());
      toc = System.currentTimeMillis();
      double[] comp = {(toc-tic) + dsComp};
      Result res = new Result(comp, "comp time");
      resTable.addResult(res);
    }   
    System.out.println(resTable);
   
   
    resTable.newRow("WL Kernel");
    for (double frac : fractionsSlow) {
      createGeoDataSet((int)(1000 * frac), frac, seed, "http://data.bgs.ac.uk/ref/Lexicon/hasUnitClass");   
      tic = System.currentTimeMillis();
      PropertyPredictionDataSet ds = DataSetFactory.createPropertyPredictionDataSet(new GeneralPredictionDataSetParameters(dataset, blackLists, instances, 3, false, true));
      toc = System.currentTimeMillis();
      double dsComp = toc-tic;
     
      GraphKernel k = new WLSubTreeKernel(6,true);
     
      System.out.println("WL: " + frac);
      tic = System.currentTimeMillis();
      k.compute(ds.getGraphs());
      toc = System.currentTimeMillis();
      double[] comp = {(toc-tic) + dsComp};
      Result res = new Result(comp, "comp time");
      resTable.addResult(res);
    }   
    System.out.println(resTable);
   
   
View Full Code Here

        tic = System.currentTimeMillis();
        k.computeFeatureVectors(dataset, instances, blackList);
        toc = System.currentTimeMillis();
        comp[i] = toc-tic;
      }
      Result res = new Result(comp, "comp time");
      resTable.addResult(res);
      //}
      //System.out.println(resTable);

      //resTable.newRow("WLRDF Kernel");
      //for (double frac : fractions) {
      comp = new double[seeds.length];
      for (int i = 0; i < seeds.length; i++) {
        createGeoDataSet((int)(1000 * frac), frac, seeds[i], "http://data.bgs.ac.uk/ref/Lexicon/hasTheme");   

        RDFGraphKernel k = new RDFWLSubTreeKernel(6,3,false, true);

        System.out.println("RDF WL Kernel: " + frac);
        tic = System.currentTimeMillis();
        k.compute(dataset, instances, blackList);
        toc = System.currentTimeMillis();
        comp[i] = toc-tic;
      }
      res = new Result(comp, "comp time");
      resTable.addResult(res);
      //} 
      //System.out.println(resTable);

      //resTable.newRow("WLRDF text FV");
      //for (double frac : fractions) {
      comp = new double[seeds.length];
      for (int i = 0; i < seeds.length; i++) {
        createGeoDataSet((int)(1000 * frac), frac, seeds[i], "http://data.bgs.ac.uk/ref/Lexicon/hasTheme");   

        RDFFeatureVectorKernel k = new RDFWLSubTreeWithTextKernel(6,3,false, false);

        System.out.println("RDF WL text FV: " + frac);
        tic = System.currentTimeMillis();
        TextUtils.computeTFIDF(Arrays.asList(k.computeFeatureVectors(dataset, instances, blackList)));       
        toc = System.currentTimeMillis();
        comp[i] = toc-tic;
      }
      res = new Result(comp, "comp time");
      resTable.addResult(res);
      //}
      //System.out.println(resTable);


      //resTable.newRow("EVP FV");
      //for (double frac : fractions) {
      comp = new double[seeds.length];
      for (int i = 0; i < seeds.length; i++) {
        createGeoDataSet((int)(1000 * frac), frac, seeds[i], "http://data.bgs.ac.uk/ref/Lexicon/hasTheme");   

        RDFFeatureVectorKernel k = new RDFIntersectionTreeEdgeVertexPathKernel(3,false, false, true);

        System.out.println("RDF EVP FV: " + frac);
        tic = System.currentTimeMillis();
        k.computeFeatureVectors(dataset, instances, blackList);
        toc = System.currentTimeMillis();
        comp[i] = toc-tic;
      }
      res = new Result(comp, "comp time");
      resTable.addResult(res);
      //}
      //System.out.println(resTable);

      //resTable.newRow("EVP Kernel");
      //for (double frac : fractions) {
      comp = new double[seeds.length];
      for (int i = 0; i < seeds.length; i++) {
        createGeoDataSet((int)(1000 * frac), frac, seeds[i], "http://data.bgs.ac.uk/ref/Lexicon/hasTheme");   

        RDFGraphKernel k = new RDFIntersectionTreeEdgeVertexPathKernel(3,false, false, true);

        System.out.println("RDF EVP Kernel: " + frac);
        tic = System.currentTimeMillis();
        k.compute(dataset, instances, blackList);
        toc = System.currentTimeMillis();
        comp[i] = toc-tic;
      }
      res = new Result(comp, "comp time");
      resTable.addResult(res);
      //}
      //System.out.println(resTable);

      //resTable.newRow("EVP text FV");
      //for (double frac : fractions) {
      comp = new double[seeds.length];
      for (int i = 0; i < seeds.length; i++) {
        createGeoDataSet((int)(1000 * frac), frac, seeds[i], "http://data.bgs.ac.uk/ref/Lexicon/hasTheme");   

        RDFFeatureVectorKernel k = new RDFIntersectionTreeEdgeVertexPathWithTextKernel(3,false, false, false);

        System.out.println("EVP text FV: " + frac);
        tic = System.currentTimeMillis();
        TextUtils.computeTFIDF(Arrays.asList(k.computeFeatureVectors(dataset, instances, blackList)));       
        toc = System.currentTimeMillis();
        comp[i] = toc-tic;
      }
      res = new Result(comp, "comp time");
      resTable.addResult(res);
      //}
      //System.out.println(resTable);




      //resTable.newRow("RDF IST");
      //for (double frac : fractions) {
      comp = new double[seeds.length];
      for (int i = 0; i < seeds.length; i++) {
        createGeoDataSet((int)(1000 * frac), frac, seeds[i], "http://data.bgs.ac.uk/ref/Lexicon/hasTheme");   
        RDFGraphKernel k = new RDFIntersectionSubTreeKernel(3,1, false, true);


        System.out.println("RDF IST: " + frac);
        tic = System.currentTimeMillis();
        k.compute(dataset, instances, blackList);
        toc = System.currentTimeMillis();
        comp[i] = toc-tic;
      }
      res = new Result(comp, "comp time");
      resTable.addResult(res);
      //}
      //System.out.println(resTable);



     
    //resTable.newRow("WL FV");
    //for (double frac : fractionsSlow) {
      comp = new double[seeds.length];
      for (int i = 0; i < seeds.length; i++) {
        createGeoDataSet((int)(1000 * frac), frac, seeds[i], "http://data.bgs.ac.uk/ref/Lexicon/hasTheme");   
        tic = System.currentTimeMillis();
        PropertyPredictionDataSet ds = DataSetFactory.createPropertyPredictionDataSet(new GeneralPredictionDataSetParameters(dataset, blackLists, instances, 3, false, true));
        toc = System.currentTimeMillis();
        double dsComp = toc-tic;

        FeatureVectorKernel k = new WLSubTreeKernel(6,true);

        System.out.println("WL: " + frac);
        tic = System.currentTimeMillis();
        k.computeFeatureVectors(ds.getGraphs());
        toc = System.currentTimeMillis();
        comp[i] = (toc-tic) + dsComp;
      }
      res = new Result(comp, "comp time");
      resTable.addResult(res);
    //}   
    //System.out.println(resTable);


    //resTable.newRow("WL Kernel");
    //for (double frac : fractionsSlow) {
      comp = new double[seeds.length];
      for (int i = 0; i < seeds.length; i++) {
        createGeoDataSet((int)(1000 * frac), frac, seeds[i], "http://data.bgs.ac.uk/ref/Lexicon/hasTheme");   
        tic = System.currentTimeMillis();
        PropertyPredictionDataSet ds = DataSetFactory.createPropertyPredictionDataSet(new GeneralPredictionDataSetParameters(dataset, blackLists, instances, 3, false, true));
        toc = System.currentTimeMillis();
        double dsComp = toc-tic;

        GraphKernel k = new WLSubTreeKernel(6,true);

        System.out.println("WL: " + frac);
        tic = System.currentTimeMillis();
        k.compute(ds.getGraphs());
        toc = System.currentTimeMillis();
        comp[i] = (toc-tic) + dsComp;
      }
      res = new Result(comp, "comp time");
      resTable.addResult(res);
    }   
    //}
    System.out.println(resTable);
  }
View Full Code Here

TOP

Related Classes of org.data2semantics.exp.utils.Result

Copyright © 2018 www.massapicom. 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.