Package org.data2semantics.exp.old.utils.datasets

Examples of org.data2semantics.exp.old.utils.datasets.LinkPredictionDataSet


    dataSetsParams.add(new LinkPredictionDataSetParameters(testSetB, "http://swrc.ontoware.org/ontology#Person", "http://swrc.ontoware.org/ontology#ResearchGroup", "http://swrc.ontoware.org/ontology#affiliation", bl, 2, true, false));
    dataSetsParams.add(new LinkPredictionDataSetParameters(testSetB, "http://swrc.ontoware.org/ontology#Person", "http://swrc.ontoware.org/ontology#ResearchGroup", "http://swrc.ontoware.org/ontology#affiliation", bl, 1, true, true));
    dataSetsParams.add(new LinkPredictionDataSetParameters(testSetB, "http://swrc.ontoware.org/ontology#Person", "http://swrc.ontoware.org/ontology#ResearchGroup", "http://swrc.ontoware.org/ontology#affiliation", bl, 2, true, true));
    */

    LinkPredictionDataSet dataset;
    LinkPredictionExperiment exp;

    ResultsTable resultsWL  = new ResultsTable();
    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());
          }
        }


        /*
 
View Full Code Here


    List<String> bl = new ArrayList<String>();
    bl.add("http://swrc.ontoware.org/ontology#affiliation");
    bl.add("http://swrc.ontoware.org/ontology#employs");
   
    RDFDataSet testSet = new RDFFileDataSet("D:\\workspaces\\datasets\\aifb\\aifb-fixed_complete.rdf", RDFFormat.RDFXML);
    LinkPredictionDataSet set = DataSetFactory.createLinkPredictonDataSet(testSet, "http://swrc.ontoware.org/ontology#Person", "http://swrc.ontoware.org/ontology#ResearchGroup", "http://swrc.ontoware.org/ontology#affiliation", bl, 2, false, false);
    System.out.println(set.getLabel());
    System.out.println(set.getLabels().size());
  }
View Full Code Here

    List<String> bl = new ArrayList<String>();
    bl.add("http://swrc.ontoware.org/ontology#affiliation");
    bl.add("http://swrc.ontoware.org/ontology#employs");
   
    RDFDataSet testSet = new RDFFileDataSet("D:\\workspaces\\datasets\\aifb\\aifb-fixed_complete.rdf", RDFFormat.RDFXML);
    LinkPredictionDataSet set = DataSetFactory.createLinkPredictonDataSet(testSet, "http://swrc.ontoware.org/ontology#Person", "http://swrc.ontoware.org/ontology#ResearchGroup", "http://swrc.ontoware.org/ontology#affiliation", bl, 2, false, false);
   
   
   
   
    new LinkPredictionExperiment(set, new WLSubTreeKernel(2), new WLSubTreeKernel(2), 1, 0, seeds, cs).run();
View Full Code Here

TOP

Related Classes of org.data2semantics.exp.old.utils.datasets.LinkPredictionDataSet

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.