Package org.data2semantics.proppred.kernels.rdfgraphkernels

Examples of org.data2semantics.proppred.kernels.rdfgraphkernels.RDFWLSubTreeKernel$VertexIndexPair


    ///* 
    for (int i : depths) {     
      for (int it : iterations) {
        resTable.newRow("RDF WL, " + i + ", " + it);

        RDFWLSubTreeKernel k = new RDFWLSubTreeKernel(it, i, inference, true, forward, false);

        KernelExperiment<RDFGraphKernel> exp = new RDFGraphKernelExperiment(k, seeds, svmParms, dataset, instances, target, blackList, evalFuncs);

        System.out.println("Running WL RDF: " + i + " " + it);
        exp.run();

        for (Result res : exp.getResults()) {
          resTable.addResult(res);
       
      }
    }
    System.out.println(resTable);
    //*/


    ///*
    for (int i : depths) {     
      for (int it : iterations) {
        resTable.newRow("RDF WL TYPE, " + i + ", " + it);

        RDFWLSubTreeSlashBurnKernel k = new RDFWLSubTreeSlashBurnKernel(it, i, inference, true, forward);
        k.setHubMap(GraphUtils.createRDFTypeHubMap(dataset, inference));
        k.setRelabel(relabel);
       
        KernelExperiment<RDFGraphKernel> exp = new RDFGraphKernelExperiment(k, seeds, svmParms, dataset, instances, target, blackList, evalFuncs);

        System.out.println("Running WL RDF TYPE: " + i + " " + it);
        exp.run();

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


    ///*
    for (int h : hf) {
      for (int i : depths) {     
        for (int it : iterations) {
          resTable.newRow("RDF WL Regular Degree, " + h + ", " + i + ", " + it);

          RDFWLSubTreeSlashBurnKernel k = new RDFWLSubTreeSlashBurnKernel(it, i, inference, true, forward);
          k.setHubMap(GraphUtils.createNonSigHubMap(nonSigDegreeHubs, h));
          k.setRelabel(relabel);

          KernelExperiment<RDFGraphKernel> exp = new RDFGraphKernelExperiment(k, seeds, svmParms, dataset, instances, target, blackList, evalFuncs);

          System.out.println("Running WL RDF Regular Degree: " + i + " " + it + " " + h);
          exp.run();

          for (Result res : exp.getResults()) {
            resTable.addResult(res);
         
        }
      }
    }
    System.out.println(resTable);
    //*/


    ///*
    for (int h : hf) {
      for (int i : depths) {     
        for (int it : iterations) {
          resTable.newRow("RDF WL Signature Degree (SB), " + h + ", " + i + ", " + it);

          RDFWLSubTreeSlashBurnKernel k = new RDFWLSubTreeSlashBurnKernel(it, i, inference, true, forward);
          k.setHubMap(GraphUtils.createHubMap(hubs, h));
          k.setRelabel(relabel);

          KernelExperiment<RDFGraphKernel> exp = new RDFGraphKernelExperiment(k, seeds, svmParms, dataset, instances, target, blackList, evalFuncs);

          System.out.println("Running WL RDF fwd SB: " + i + " " + it + " " + h);
          exp.run();

          for (Result res : exp.getResults()) {
            resTable.addResult(res);
         
        }
      }
    }
    System.out.println(resTable);
    //*/

    ///*
    for (int i : depths) {     
      resTable.newRow("RDF IST, " + i);
      RDFIntersectionSubTreeKernel k = new RDFIntersectionSubTreeKernel(i, 1, inference, true);
     
      KernelExperiment<RDFGraphKernel> exp = new RDFGraphKernelExperiment(k, seeds, svmParms, dataset, instances, target, blackList, evalFuncs);

      System.out.println("Running RDF IST: " + i);
      exp.run();

      for (Result res : exp.getResults()) {
        resTable.addResult(res);
     
    }
    System.out.println(resTable);
    //*/

    ///*
    for (int i : depths) {     
      resTable.newRow("RDF IST TYPE, " + i);
      RDFIntersectionSubTreeSlashBurnKernel k = new RDFIntersectionSubTreeSlashBurnKernel(i, 1, inference, true);
      k.setHubMap(GraphUtils.createRDFTypeHubMap(dataset, inference));

      KernelExperiment<RDFGraphKernel> exp = new RDFGraphKernelExperiment(k, seeds, svmParms, dataset, instances, target, blackList, evalFuncs);

      System.out.println("Running RDF IST TYPE: " + i);
      exp.run();

      for (Result res : exp.getResults()) {
        resTable.addResult(res);
     
    }
    System.out.println(resTable);
    //*/


    ///*
    for (int h : hf) {
      for (int i : depths) {     
        resTable.newRow("RDF IST Regular Degree, " + h + ", " + i);
        RDFIntersectionSubTreeSlashBurnKernel k = new RDFIntersectionSubTreeSlashBurnKernel(i, 1, inference, true);
        k.setHubMap(GraphUtils.createNonSigHubMap(nonSigDegreeHubs, h));

        KernelExperiment<RDFGraphKernel> exp = new RDFGraphKernelExperiment(k, seeds, svmParms, dataset, instances, target, blackList, evalFuncs);

        System.out.println("Running RDF IST Regular Degree: " + i + " " + h);
        exp.run();

        for (Result res : exp.getResults()) {
          resTable.addResult(res);
       
      }
    }
    System.out.println(resTable);
    //*/


    ///*
    for (int h : hf) {
      for (int i : depths) {     
        resTable.newRow("RDF IST Signature Degree (SB), " + h + ", " + i);
        RDFIntersectionSubTreeSlashBurnKernel k = new RDFIntersectionSubTreeSlashBurnKernel(i, 1, inference, true);
        k.setHubMap(GraphUtils.createHubMap(hubs, h));

        KernelExperiment<RDFGraphKernel> exp = new RDFGraphKernelExperiment(k, seeds, svmParms, dataset, instances, target, blackList, evalFuncs);

        System.out.println("Running RDF IST Signature Degree (SB): " + i + " " + h);
        exp.run();
View Full Code Here


      for (int it : iterations) {
        resTable.newRow("");
       
       
        LibSVMParameters parms = new LibSVMParameters(LibSVMParameters.C_SVC, cs);
        KernelExperiment<RDFGraphKernel> exp = new RDFOldKernelExperiment(new RDFWLSubTreeKernel(it, i, inference, true), seeds, parms, dataset, instances, labels, blackList);
       
        System.out.println("Running WL RDF: " + i + " " + it);
        exp.run();
       
        for (Result res : exp.getResults()) {
View Full Code Here

   
    resTable.newRow("WLRDF FV");
    for (double frac : fractions) {
      createGeoDataSet((int)(1000 * frac), frac, seed, "http://data.bgs.ac.uk/ref/Lexicon/hasUnitClass");   

      RDFFeatureVectorKernel k = new RDFWLSubTreeKernel(6,3,false, true);
     
      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);
    }   
View Full Code Here

             @In(name="labels") ArrayList<Value> labels,
             @In(name="blacklist"ArrayList<Statement> blackList,
             @In(name="iteration") int iteration,
             @In(name="depth") int depth){
   
    kernel = new RDFWLSubTreeKernel(iteration,  depth, true, true);
   
    sparseVector = kernel.computeFeatureVectors(dataset, instances, blackList);
   
    return sparseVector;
  }
View Full Code Here

    evalFuncs.add(new Accuracy());
    evalFuncs.add(new F1());
    long[] seeds2={seed};
    System.out.println(dataset + " " + labels.size() + " " + instances.size() + " " + blackList.size());
   
    RDFLinearKernelExperiment exp = new RDFLinearKernelExperiment(new RDFWLSubTreeKernel(iteration, depth, true, true), seeds2, linParms, dataset, instances, target, blackList, evalFuncs);
   
    exp.setDoCV(true);
    exp.run();
   
    System.out.println(exp.getResults());
View Full Code Here

    for (Resource instance : instances) {
      blackList.addAll(dataset.getStatementsFromStrings(instance.toString(), "http://swrc.ontoware.org/ontology#affiliation", null));
      blackList.addAll(dataset.getStatementsFromStrings(null, "http://swrc.ontoware.org/ontology#employs", instance.toString()));
    }
   
    new RDFWLSubTreeKernel().compute(dataset, instances, blackList);
  }
View Full Code Here

    */
   
    for (int depth : depths) {
      resTable.newRow("");
      for (int it : iterations) {
        RDFLinearKernelExperiment exp = new RDFLinearKernelExperiment(new RDFWLSubTreeKernel(it, depth, inference, normalize), seeds, linParms, dataset, instances, targets, blackList, evalFuncs);

        System.out.println("Running WL RDF: " + depth + " " + it);
        exp.setDoCV(true);
        exp.setDoTFIDF(tfidf);
        exp.run();

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

   
System.out.println(resTable);
   
    for (int depth : depths) {
      resTable.newRow("");
      for (int it : iterations) {
        List<RDFFeatureVectorKernel> kernels = new ArrayList<RDFFeatureVectorKernel>();
        RDFWLSubTreeKernel k = new RDFWLSubTreeKernel(it, depth, inference, normalize);
       
        kernels.add(k);
        kernels.add(new RDFSimpleTextKernel(depth, inference, normalize));

        RDFFeatureVectorKernel kernel = new RDFCombinedKernel(kernels, normalize);
View Full Code Here

      //for (double frac : fractions) {
      double[] 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 RDFWLSubTreeKernel(6,3,false, true);

        System.out.println("RDF WL FV: " + frac);
        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);
View Full Code Here

     
      for (int i : depths) {     
        for (int it : iterations) {
          resTable.newRow("")

          KernelExperiment<RDFFeatureVectorKernel> exp = new RDFLinearKernelExperiment(new RDFWLSubTreeKernel(it, i, inference, true), seeds, linParms, dataset, instances, target, blackList, evalFuncs);
       
          System.out.println("Running WL RDF: " + i + " " + it);
          exp.run();

          for (Result res : exp.getResults()) {
View Full Code Here

          }
          linParms.setWeightLabels(wLabels);
          linParms.setWeights(weights);


          RDFLinearKernelExperiment exp = new RDFLinearKernelExperiment(new RDFWLSubTreeKernel(it, d, inference, true), s2, linParms, dataset, instances, targets, blackList, evalFuncs);
          res.add(exp.getResults());

          System.out.println("Running WL RDF: " + d + " " + it);
          exp.run();
        }
View Full Code Here

TOP

Related Classes of org.data2semantics.proppred.kernels.rdfgraphkernels.RDFWLSubTreeKernel$VertexIndexPair

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.