Package org.data2semantics.exp.old.utils

Examples of org.data2semantics.exp.old.utils.Experimenter


    ResultsTable resultsSTF = new ResultsTable();
    ResultsTable resultsSTP = new ResultsTable();
    ResultsTable resultsIGW = new ResultsTable();
    ResultsTable resultsIGP = new ResultsTable();

    Experimenter experimenter = new Experimenter(NUMBER_OF_PROC);
    Thread expT = new Thread(experimenter);
    expT.setDaemon(true);
    expT.start();



    try {
      for (GeneralPredictionDataSetParameters params : dataSetsParams) {
        dataset = DataSetFactory.createPropertyPredictionDataSet(params);
        //dataset.removeSmallClasses(5);
        dataset.setLabels(labels);
        //dataset.removeVertexAndEdgeLabels();

       
       
        resultsWL.newRow(dataset.getLabel() + " WLSubTreeKernel");
        for (int i = 0; i < 4; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "WL" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new WLSubTreeKernel(i), seeds, cs, maxClassSize, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsWL.addResult(exp.getResults().getAccuracy());
            resultsWL.addResult(exp.getResults().getF1());
          }
        }


       
        resultsSTF.newRow(dataset.getLabel() + " IntersectionFullSubTree");
        for (int i = 0; i < 4; i++) {

          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionFullSubTree" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionSubTreeKernel(i, 1), seeds, cs, maxClassSize, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsSTF.addResult(exp.getResults().getAccuracy());
            resultsSTF.addResult(exp.getResults().getF1());
          }
        }

        resultsSTP.newRow(dataset.getLabel() + " IntersectionPartialSubTree");
        for (int i = 0; i < 4; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionPartialSubTree" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionPartialSubTreeKernel(i, 0.01), seeds, cs, maxClassSize, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsSTP.addResult(exp.getResults().getAccuracy());
            resultsSTP.addResult(exp.getResults().getF1());
          }
        }

        //*/


       
        resultsIGP.newRow(dataset.getLabel() + " IntersectionGraphPath");
        for (int i = 1; i < 3; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionGraphPath" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionGraphPathKernel(i, 1), seeds, cs, maxClassSize, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsIGP.addResult(exp.getResults().getAccuracy());
            resultsIGP.addResult(exp.getResults().getF1());
          }
        }       

        resultsIGW.newRow(dataset.getLabel() + " IntersectionGraphWalk");
        for (int i = 1; i < 3; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionGraphWalk" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionGraphWalkKernel(i, 1), seeds, cs, maxClassSize, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsIGW.addResult(exp.getResults().getAccuracy());
            resultsIGW.addResult(exp.getResults().getF1());
          }
        }
        //*/       

      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    experimenter.stop();

    while (expT.isAlive()) {
      try {
        Thread.sleep(1000);
      } catch (Exception e) {
View Full Code Here


    boolean inference = false;
    for (int i = 1; i <= depth; i++) {
      resTable.newRow("WL RDF, no inference, depth="+i);
      for (int it : iterations) {
        Experimenter experimenter = new Experimenter(2);
        Thread expT = new Thread(experimenter);
        expT.setDaemon(true);
        expT.start();       

        List<List<Result>> res = new ArrayList<List<Result>>();
        for (long seed : seeds) {
          long[] s2 = new long[1];
          s2[0] = seed;
          createGeoDataSet(seed, fraction, minSize, "http://data.bgs.ac.uk/ref/Lexicon/hasTheme");
          KernelExperiment<RDFGraphKernel> exp = new RDFOldKernelExperiment(new ECML2013RDFWLSubTreeKernel(it, i, inference, true, false), s2, parms, dataset, instances, labels, blackList);
          res.add(exp.getResults());

          System.out.println("Running WL RDF: " + i + " " + it);
          if (experimenter.hasSpace()) {
            experimenter.addExperiment(exp);
          }


        }

        experimenter.stop();
        try {
          while (expT.isAlive()) {
            Thread.sleep(1000);
          }
        } catch (Exception e) {
          e.printStackTrace();
        }

        for (Result res2 : Result.mergeResultLists(res)) {
          resTable.addResult(res2);
        }
      }
    }
    saveResults(resTable, "geo_theme.ser");


    inference = true;
    for (int i = 1; i <= depth; i++) {
      resTable.newRow("WL RDF, inference, depth="+i);
      for (int it : iterations) {
        Experimenter experimenter = new Experimenter(2);
        Thread expT = new Thread(experimenter);
        expT.setDaemon(true);
        expT.start();


        List<List<Result>> res = new ArrayList<List<Result>>();
        for (long seed : seeds) {
          long[] s2 = new long[1];
          s2[0] = seed;
          createGeoDataSet(seed, fraction, minSize, "http://data.bgs.ac.uk/ref/Lexicon/hasTheme");
          KernelExperiment<RDFGraphKernel> exp = new RDFOldKernelExperiment(new ECML2013RDFWLSubTreeKernel(it, i, inference, true, false), s2, parms, dataset, instances, labels, blackList);
          res.add(exp.getResults());

          System.out.println("Running WL RDF: " + i + " " + it);
          if (experimenter.hasSpace()) {
            experimenter.addExperiment(exp);
          }


        }

        experimenter.stop();

        while (expT.isAlive()) {
          try {
            Thread.sleep(1000);
          } catch (Exception e) {
            e.printStackTrace();
          }
        }

        for (Result res2 : Result.mergeResultLists(res)) {
          resTable.addResult(res2);
        }
      }
    }
    saveResults(resTable, "geo_theme.ser");


    inference = false;
    for (int i = 1; i <= depth; i++) {
      resTable.newRow("IST, no inference, depth="+i);

      Experimenter experimenter = new Experimenter(2);
      Thread expT = new Thread(experimenter);
      expT.setDaemon(true);
      expT.start();

      List<List<Result>> res = new ArrayList<List<Result>>();
      for (long seed : seeds) {
        long[] s2 = new long[1];
        s2[0] = seed;
        createGeoDataSet(seed, fraction,  minSize, "http://data.bgs.ac.uk/ref/Lexicon/hasTheme");
        KernelExperiment<RDFGraphKernel> exp = new RDFOldKernelExperiment(new RDFIntersectionSubTreeKernel(i, 1, inference, true, false), s2, parms, dataset, instances, labels, blackList);
        res.add(exp.getResults());

        System.out.println("Running IST: " + i);
        if (experimenter.hasSpace()) {
          experimenter.addExperiment(exp);
        }
      }

      experimenter.stop();

      while (expT.isAlive()) {
        try {
          Thread.sleep(1000);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }

      for (Result res2 : Result.mergeResultLists(res)) {
        resTable.addResult(res2);
      }
    }
    saveResults(resTable, "geo_theme.ser");


    inference = true;
    for (int i = 1; i <= depth; i++) {
      resTable.newRow("IST, inference, depth="+i);

      Experimenter experimenter = new Experimenter(2);
      Thread expT = new Thread(experimenter);
      expT.setDaemon(true);
      expT.start();

      List<List<Result>> res = new ArrayList<List<Result>>();
      for (long seed : seeds) {
        long[] s2 = new long[1];
        s2[0] = seed;
        createGeoDataSet(seed, fraction,  minSize, "http://data.bgs.ac.uk/ref/Lexicon/hasTheme");
        KernelExperiment<RDFGraphKernel> exp = new RDFOldKernelExperiment(new RDFIntersectionSubTreeKernel(i, 1, inference, true, false), s2, parms, dataset, instances, labels, blackList);
        res.add(exp.getResults());


        System.out.println("Running IST: " + i);
        if (experimenter.hasSpace()) {
          experimenter.addExperiment(exp);
        }

      }

      experimenter.stop();

      while (expT.isAlive()) {
        try {
          Thread.sleep(1000);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }

      for (Result res2 : Result.mergeResultLists(res)) {
        resTable.addResult(res2);
      }
    }
    saveResults(resTable, "geo_theme.ser");


    inference = false;
    for (int i = 1; i <= depth; i++) {
      resTable.newRow("IPST, no inference, depth="+i);

      Experimenter experimenter = new Experimenter(2);
      Thread expT = new Thread(experimenter);
      expT.setDaemon(true);
      expT.start();

      List<List<Result>> res = new ArrayList<List<Result>>();
      for (long seed : seeds) {
        long[] s2 = new long[1];
        s2[0] = seed;
        createGeoDataSet(seed, fraction,  minSize, "http://data.bgs.ac.uk/ref/Lexicon/hasTheme");
        KernelExperiment<RDFGraphKernel> exp = new RDFOldKernelExperiment(new RDFIntersectionPartialSubTreeKernel(i, 0.01, inference, true, false), s2, parms, dataset, instances, labels, blackList);
        res.add(exp.getResults());

        System.out.println("Running IPST: " + i);
        if (experimenter.hasSpace()) {
          experimenter.addExperiment(exp);
        }
      }

      experimenter.stop();

      while (expT.isAlive()) {
        try {
          Thread.sleep(1000);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }

      for (Result res2 : Result.mergeResultLists(res)) {
        resTable.addResult(res2);
      }
    }
    saveResults(resTable, "geo_theme.ser");



    inference = true;
    for (int i = 1; i <= depth; i++) {
      resTable.newRow("IPST, inference, depth="+i);

      Experimenter experimenter = new Experimenter(2);
      Thread expT = new Thread(experimenter);
      expT.setDaemon(true);
      expT.start();

      List<List<Result>> res = new ArrayList<List<Result>>();
      for (long seed : seeds) {
        long[] s2 = new long[1];
        s2[0] = seed;
        createGeoDataSet(seed, fraction,  minSize, "http://data.bgs.ac.uk/ref/Lexicon/hasTheme");
        KernelExperiment<RDFGraphKernel> exp = new RDFOldKernelExperiment(new RDFIntersectionPartialSubTreeKernel(i, 0.01, inference, true, false), s2, parms, dataset, instances, labels, blackList);
        res.add(exp.getResults());

        System.out.println("Running IPST: " + i);
        if (experimenter.hasSpace()) {
          experimenter.addExperiment(exp);
        }
      }

      experimenter.stop();

      while (expT.isAlive()) {
        try {
          Thread.sleep(1000);
        } catch (Exception e) {
View Full Code Here

    ResultsTable resultsSTF = new ResultsTable();
    ResultsTable resultsSTP = new ResultsTable();
    ResultsTable resultsIGW = new ResultsTable();
    ResultsTable resultsIGP = new ResultsTable();

    Experimenter experimenter = new Experimenter(NUMBER_OF_PROC);
    Thread expT = new Thread(experimenter);
    expT.setDaemon(true);
    expT.start();



    try {
      for (BinaryPropertyPredictionDataSetParameters params : dataSetsParams) {
        dataset = DataSetFactory.createPropertyPredictionDataSet(params);
        dataset.removeSmallClasses(5);
        dataset.setLabels(labels);
        //dataset.removeVertexAndEdgeLabels();

        resultsWL.newRow(dataset.getLabel() + " WLSubTreeKernel");

        for (int i = 0; i < 4; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "WL" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new WLSubTreeKernel(i), seeds, cs, maxClassSize, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsWL.addResult(exp.getResults().getAccuracy());
            resultsWL.addResult(exp.getResults().getF1());
           
            System.out.println("Running WL, it " + i + " on " + dataset.getLabel());
          }
        }

       
        resultsSTF.newRow(dataset.getLabel() + " IntersectionFullSubTree");
        for (int i = 0; i < 3; i++) {

          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionFullSubTree" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionSubTreeKernel(i, 1), seeds, cs, maxClassSize, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsSTF.addResult(exp.getResults().getAccuracy());
            resultsSTF.addResult(exp.getResults().getF1());
           
            System.out.println("Running STF, it " + i + " on " + dataset.getLabel());
          }
        }

        resultsSTP.newRow(dataset.getLabel() + " IntersectionPartialSubTree");
        for (int i = 0; i < 3; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionPartialSubTree" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionPartialSubTreeKernel(i, 0.01), seeds, cs, maxClassSize, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsSTP.addResult(exp.getResults().getAccuracy());
            resultsSTP.addResult(exp.getResults().getF1());
           
            System.out.println("Running STP, it " + i + " on " + dataset.getLabel());
          }
        }


       
        resultsIGP.newRow(dataset.getLabel() + " IntersectionGraphPath");
        for (int i = 1; i < 3; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionGraphPath" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionGraphPathKernel(i, 1), seeds, cs, maxClassSize, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsIGP.addResult(exp.getResults().getAccuracy());
            resultsIGP.addResult(exp.getResults().getF1());
           
            System.out.println("Running IGP, it " + i + " on " + dataset.getLabel());
          }
        }       

        resultsIGW.newRow(dataset.getLabel() + " IntersectionGraphWalk");
        for (int i = 1; i < 3; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionGraphWalk" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionGraphWalkKernel(i, 1), seeds, cs, maxClassSize, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsIGW.addResult(exp.getResults().getAccuracy());
            resultsIGW.addResult(exp.getResults().getF1());
           
            System.out.println("Running IGW, it " + i + " on " + dataset.getLabel());
          }
        }
        //*/


      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    experimenter.stop();

    while (expT.isAlive()) {
      try {
        Thread.sleep(1000);
      } catch (Exception e) {
View Full Code Here

    ResultsTable resultsSTF = new ResultsTable();
    ResultsTable resultsSTP = new ResultsTable();
    ResultsTable resultsIGW = new ResultsTable();
    ResultsTable resultsIGP = new ResultsTable();

    Experimenter experimenter = new Experimenter(NUMBER_OF_PROC);
    Thread expT = new Thread(experimenter);
    expT.setDaemon(true);
    expT.start();



    try {
      for (LinkPredictionDataSetParameters params : dataSetsParams) {
        dataset = DataSetFactory.createLinkPredictonDataSet(params);
        //dataset.removeSmallClasses(5);

        resultsWL.newRow(dataset.getLabel() + " WLSubTreeKernel");
        for (int i = 0; i < 3; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + "_" + "WL" + fileId + "_" + i + ".txt");
            exp = new LinkPredictionExperiment(new LinkPredictionDataSet(dataset), new WLSubTreeKernel(i), new WLSubTreeKernel(i), 3.0/6.0, 3.0/6.0, seeds, cs, maxClassSize, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsWL.addResult(exp.getResults().getAccuracy());
            resultsWL.addResult(exp.getResults().getF1());
            resultsWL.addResult(exp.getResults().getrPrecision());
            resultsWL.addResult(exp.getResults().getAveragePrecision());
            resultsWL.addResult(exp.getResults().getNdcg());
           
            System.out.println("Running WL, it " + i + " on " + dataset.getLabel());
          }
        }


        resultsSTF.newRow(dataset.getLabel() + " IntersectionFullSubTreeKernel");
        for (int i = 0; i < 3; i++) {

          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + "_" + "IntersectionFullSubTree" + fileId + "_" + i + ".txt");
            exp = new LinkPredictionExperiment(new LinkPredictionDataSet(dataset), new IntersectionSubTreeKernel(i,1), new IntersectionSubTreeKernel(i,1), 3.0/6.0, 3.0/6.0, seeds, cs, maxClassSize, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsSTF.addResult(exp.getResults().getAccuracy());
            resultsSTF.addResult(exp.getResults().getF1());
            resultsSTF.addResult(exp.getResults().getrPrecision());
            resultsSTF.addResult(exp.getResults().getAveragePrecision());
            resultsSTF.addResult(exp.getResults().getNdcg());
           
            System.out.println("Running STF, it " + i + " on " + dataset.getLabel());
          }
        }

        resultsSTP.newRow(dataset.getLabel() + " IntersectionPartialSubTreeKernel");
        for (int i = 0; i < 3; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + "_" + "IntersectionPartialSubTree" + fileId + "_" + i + ".txt");
            exp = new LinkPredictionExperiment(new LinkPredictionDataSet(dataset), new IntersectionPartialSubTreeKernel(i,0.01), new IntersectionPartialSubTreeKernel(i,0.01), 3.0/6.0, 3.0/6.0, seeds, cs, maxClassSize, new FileOutputStream(file))
            experimenter.addExperiment(exp);
            resultsSTP.addResult(exp.getResults().getAccuracy());
            resultsSTP.addResult(exp.getResults().getF1());
            resultsSTP.addResult(exp.getResults().getrPrecision());
            resultsSTP.addResult(exp.getResults().getAveragePrecision());
            resultsSTP.addResult(exp.getResults().getNdcg());
           
            System.out.println("Running STP, it " + i + " on " + dataset.getLabel());
          }
        }


        /*
        resultsIGW.newRow(dataset.getLabel() + " IntersectionGraphWalkKernel");
        for (int i = 1; i < 3; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000); 
            File file = new File(DATA_DIR + "_" + "IntersectionGraphWalk" + fileId + "_" + i + ".txt");
            exp = new LinkPredictionExperiment(new LinkPredictionDataSet(dataset), new IntersectionGraphWalkKernel(i,1), new IntersectionGraphWalkKernel(i,1), 0.5, 0.5, seeds, cs, maxClassSize, new FileOutputStream(file)); 
            experimenter.addExperiment(exp);
            resultsIGW.addResult(exp.getResults().getAccuracy());
            resultsIGW.addResult(exp.getResults().getF1());
            resultsIGW.addResult(exp.getResults().getrPrecision());
            resultsIGW.addResult(exp.getResults().getAveragePrecision());
            resultsIGW.addResult(exp.getResults().getNdcg());
           
            System.out.println("Running IGW, it " + i + " on " + dataset.getLabel());
          }
        }       

        resultsIGP.newRow(dataset.getLabel() + " IntersectionGraphPathKernel");
        for (int i = 1; i < 3; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000); 
            File file = new File(DATA_DIR + "_" + "IntersectionGraphPath" + fileId + "_" + i + ".txt");
            exp = new LinkPredictionExperiment(new LinkPredictionDataSet(dataset), new IntersectionGraphPathKernel(i,1), new IntersectionGraphPathKernel(i,1), 0.5, 0.5, seeds, cs, maxClassSize, new FileOutputStream(file)); 
            experimenter.addExperiment(exp);
            resultsIGP.addResult(exp.getResults().getAccuracy());
            resultsIGP.addResult(exp.getResults().getF1());
            resultsIGP.addResult(exp.getResults().getrPrecision());
            resultsIGP.addResult(exp.getResults().getAveragePrecision());
            resultsIGP.addResult(exp.getResults().getNdcg());
           
            System.out.println("Running IGP, it " + i + " on " + dataset.getLabel());
          }
        }

        //*/

      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    experimenter.stop();

    while (expT.isAlive()) {
      try {
        Thread.sleep(1000);
      } catch (Exception e) {
View Full Code Here

    double[] cs = {0.001, 0.01, 0.1, 1, 10, 100, 1000}

    PropertyPredictionDataSet dataset;
    PropertyPredictionExperiment exp;
   
    Experimenter experimenter = new Experimenter(NUMBER_OF_PROC);
    Thread expT = new Thread(experimenter);
    expT.setDaemon(true);
    expT.start();

    ResultsTable resultsWL = new ResultsTable();
    ResultsTable resultsSTF = new ResultsTable();
    ResultsTable resultsSTP = new ResultsTable();
    ResultsTable resultsIGW = new ResultsTable();
    ResultsTable resultsIGP = new ResultsTable();

    ResultsTable resultsWLadd = new ResultsTable();
    ResultsTable resultsSTFadd = new ResultsTable();
    ResultsTable resultsSTPadd = new ResultsTable();
    ResultsTable resultsIGWadd = new ResultsTable();
    ResultsTable resultsIGPadd = new ResultsTable();

   
    /** 
     * FIRST EXPERIMENT, STANDARD SETTINGS
     *
     */   
    List<PropertyPredictionDataSetParameters> dataSetsParams = new ArrayList<PropertyPredictionDataSetParameters>();

   
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 1, false, false));
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 2, false, false));
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 1, false, true));
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 2, false, true));
   
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 1, true, false));
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 2, true, false));
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 1, true, true));
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 2, true, true));
   
    /*
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetB, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 1, false, false));
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetB, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 2, false, false));
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetB, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 1, false, true));
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetB, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 2, false, true));
   
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetB, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 1, true, false));
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetB, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 2, true, false));
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetB, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 1, true, true));
    dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetB, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 2, true, true));
    //*/   
 

    try {
     
     
 
 
      for (PropertyPredictionDataSetParameters params : dataSetsParams) {
        dataset = DataSetFactory.createPropertyPredictionDataSet(params);
        dataset.removeSmallClasses(5);
        dataset.removeVertexAndEdgeLabels();

        resultsWL.newRow(dataset.getLabel() + " WLSubTreeKernel");
        for (int i = 0; i < 3; i++) {
          if (experimenter.hasSpace()) { 
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "WL" + "_" + i + ".txt");
            WLSubTreeKernel kernel = new WLSubTreeKernel(i, true);
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), kernel, seeds, cs, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsWL.addResult(exp.getResults().getAccuracy());
            resultsWL.addResult(exp.getResults().getF1());
           
            System.out.println("Running WL, it " + i + " on " + dataset.getLabel());
          }
        }

       
        resultsSTF.newRow(dataset.getLabel() + " IntersectionFullSubTree");
        for (int i = 0; i < 3; i++) {

          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionFullSubTree" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionSubTreeKernel(i, 1), seeds, cs, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsSTF.addResult(exp.getResults().getAccuracy());
            resultsSTF.addResult(exp.getResults().getF1());
           
            System.out.println("Running STF, it " + i + " on " + dataset.getLabel());
          }

        }

        resultsSTP.newRow(dataset.getLabel() + " IntersectionPartialSubTree");
        for (int i = 0; i < 3; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionPartialSubTree" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionPartialSubTreeKernel(i, 0.01), seeds, cs, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsSTP.addResult(exp.getResults().getAccuracy());
            resultsSTP.addResult(exp.getResults().getF1());
           
            System.out.println("Running STP, it " + i + " on " + dataset.getLabel());
          }
        }


       
        resultsIGP.newRow(dataset.getLabel() + " IntersectionGraphPath");
        for (int i = 1; i < 3; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionGraphPath" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionGraphPathKernel(i, 1), seeds, cs, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsIGP.addResult(exp.getResults().getAccuracy());
            resultsIGP.addResult(exp.getResults().getF1());
           
            System.out.println("Running IGP, it " + i + " on " + dataset.getLabel());
          }
        }       

        resultsIGW.newRow(dataset.getLabel() + " IntersectionGraphWalk");
        for (int i = 1; i < 3; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionGraphWalk" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionGraphWalkKernel(i, 1), seeds, cs, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsIGW.addResult(exp.getResults().getAccuracy());
            resultsIGW.addResult(exp.getResults().getF1());
           
            System.out.println("Running IGW, it " + i + " on " + dataset.getLabel());
          }
        }
       
      }
     
      //*/
     

      /******
       * ADDITIONAL EXPERIMENTS
       */
      dataSetsParams = new ArrayList<PropertyPredictionDataSetParameters>();
     
     
     
      dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 1, false, false));
      dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 2, false, false));
      dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 3, false, false));
      //dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 4, false, false));

     
      dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 1, false, true));
      dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 2, false, true));
      dataSetsParams.add(new PropertyPredictionDataSetParameters(testSetA, "http://swrc.ontoware.org/ontology#affiliation", "http://swrc.ontoware.org/ontology#employs", 3, false, true));
     

     
      for (PropertyPredictionDataSetParameters params : dataSetsParams) {
        dataset = DataSetFactory.createPropertyPredictionDataSet(params);
        dataset.removeSmallClasses(5);
        dataset.removeVertexAndEdgeLabels();

        resultsWLadd.newRow(dataset.getLabel() + " WLSubTreeKernel");
        for (int i = 0; i < 4; i++) {
          if (experimenter.hasSpace()) { 
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "WL" + "_" + i + ".txt");
            WLSubTreeKernel kernel = new WLSubTreeKernel(i, true);
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), kernel, seeds, cs, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsWLadd.addResult(exp.getResults().getAccuracy());
            resultsWLadd.addResult(exp.getResults().getF1());
           
            System.out.println("Running WL, it " + i + " on " + dataset.getLabel());
          }
        }

       
        resultsSTFadd.newRow(dataset.getLabel() + " IntersectionFullSubTree");
        for (int i = 0; i < 4; i++) {

          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionFullSubTree" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionSubTreeKernel(i, 1), seeds, cs, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsSTFadd.addResult(exp.getResults().getAccuracy());
            resultsSTFadd.addResult(exp.getResults().getF1());
           
            System.out.println("Running STF, it " + i + " on " + dataset.getLabel());
          }

        }

        resultsSTPadd.newRow(dataset.getLabel() + " IntersectionPartialSubTree");
        for (int i = 0; i < 4; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionPartialSubTree" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionPartialSubTreeKernel(i, 0.01), seeds, cs, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsSTPadd.addResult(exp.getResults().getAccuracy());
            resultsSTPadd.addResult(exp.getResults().getF1());
           
            System.out.println("Running STP, it " + i + " on " + dataset.getLabel());
          }
        }
       
        resultsIGPadd.newRow(dataset.getLabel() + " IntersectionGraphPath");
        for (int i = 1; i < 3; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionGraphPath" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionGraphPathKernel(i, 1), seeds, cs, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsIGPadd.addResult(exp.getResults().getAccuracy());
            resultsIGPadd.addResult(exp.getResults().getF1());
           
            System.out.println("Running IGP, it " + i + " on " + dataset.getLabel());
          }
        }       

        resultsIGWadd.newRow(dataset.getLabel() + " IntersectionGraphWalk");
        for (int i = 1; i < 3; i++) {
          if (experimenter.hasSpace()) {   
            int fileId = (int) (Math.random() * 100000000)
            File file = new File(DATA_DIR + fileId + "_" + "IntersectionGraphWalk" + "_" + i + ".txt");
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionGraphWalkKernel(i, 1), seeds, cs, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            resultsIGWadd.addResult(exp.getResults().getAccuracy());
            resultsIGWadd.addResult(exp.getResults().getF1());
           
            System.out.println("Running IGW, it " + i + " on " + dataset.getLabel());
          }
        }
      }
     

     
     
     
    /***********
     * END OF EXPERIMENTER
     *
     * 
     */
    } catch (Exception e) {
      e.printStackTrace();
    }

    experimenter.stop();

    while (expT.isAlive()) {
      try {
        Thread.sleep(1000);
      } catch (Exception e) {
View Full Code Here

    PropertyPredictionDataSet dataset;
    PropertyPredictionExperiment exp;

    List<ExperimentResults> results = new ArrayList<ExperimentResults>();
   
    Experimenter experimenter = new Experimenter(3);
    Thread expT = new Thread(experimenter);
    expT.setDaemon(true);
    expT.start();

    //double[][] results = new double[dataSetsParams.size()][3];

    int j = 0;
    for (PropertyPredictionDataSetParameters params : dataSetsParams) {
      dataset = DataSetFactory.createPropertyPredictionDataSet(params);
      dataset.removeSmallClasses(5);
     
      for (int i = 0; i < 3; i++) {

        if (experimenter.hasSpace()) {
         
          int fileId = (int) (Math.random() * 10000000);
         
          File file = new File("D:\\workspaces\\datasets\\aifb\\" + fileId + "_" + "IGP" + "_" + i + ".txt");
          //file.mkdirs();
         
          try {
            //exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new IntersectionSubTreeKernel(i, 1), seeds, cs);
            exp = new PropertyPredictionExperiment(new PropertyPredictionDataSet(dataset), new WLSubTreeKernel(i), seeds, cs);
           
            //exp = new ClassificationExperiment(new GraphClassificationDataSet(dataset), new IntersectionGraphPathKernel(i, 1), seeds, cs, new FileOutputStream(file));
            experimenter.addExperiment(exp);
            results.add(exp.getResults());

          } catch (Exception e) {
            e.printStackTrace();
          }
          //exp = new ClassificationExperiment(dataset, new IntersectionSubTreeKernel(dataset.getGraphs(), dataset.getRootVertices(), i, 1), seeds, cs);
          //exp = new ClassificationExperiment(dataset, new IntersectionGraphPathKernel(dataset.getGraphs(), i, 1), seeds, cs);

         
          //results[j][i] = exp.getAccuracy();
        }
      }
      j++;
    }
   
    experimenter.stop();
   
    while (expT.isAlive()) {
      try {
        Thread.sleep(1000);
      } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.data2semantics.exp.old.utils.Experimenter

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.