Package org.data2semantics.proppred.learners

Examples of org.data2semantics.proppred.learners.SparseVector


    // List<UTGraph<StringLabel,?>> graphs = copyGraphs(trainGraphs);
    List<UTGraph<StringLabel,Object>> graphs = copyGraphs(trainGraphs);

    SparseVector[] featureVectors = new SparseVector[graphs.size()];
    for (int i = 0; i < featureVectors.length; i++) {
      featureVectors[i] = new SparseVector();
   
    //double[][] featureVectors = new double[graphs.size()][];
    Map<String, String> labelDict = new HashMap<String,String>();

    int startLabel = 1;
View Full Code Here


  }

  public SparseVector[] computeFeatureVectors(RDFDataSet dataset, List<Resource> instances, List<Statement> blackList) {
    SparseVector[] featureVectors = new SparseVector[instances.size()];
    for (int i = 0; i < featureVectors.length; i++) {
      featureVectors[i] = new SparseVector();
   

    DirectedGraph<Vertex<Map<Integer,StringBuilder>>,Edge<Map<Integer,StringBuilder>>> graph = createGraphFromRDF(dataset, instances, blackList);
    createInstanceIndexMaps(graph, instances);
View Full Code Here


  public SparseVector[] computeFeatureVectors(RDFDataSet dataset, List<Resource> instances, List<Statement> blackList) {
    SparseVector[] featureVectors = new SparseVector[instances.size()];
    for (int i = 0; i < featureVectors.length; i++) {
      featureVectors[i] = new SparseVector();
   

    DTGraph<MapLabel,MapLabel> graph = createGraphFromRDF(dataset, instances, new HashSet<Statement>(blackList));
    // separate method to remove root labels, because slash burn will also do this in a different way, we want to play with this.
    //removeRootLabels(instances);
View Full Code Here

  public SparseVector[] computeFeatureVectors(List<DTGraph<String,String>> trainGraphs) {
    List<DTGraph<StringLabel,StringLabel>> graphs = copyGraphs(trainGraphs);
    SparseVector[] featureVectors = new SparseVector[graphs.size()];
    for (int i = 0; i < featureVectors.length; i++) {
      featureVectors[i] = new SparseVector();
   
    //double[][] featureVectors = new double[graphs.size()][];
    Map<String, String> labelDict = new HashMap<String,String>();

    int startLabel = 1;
View Full Code Here

  }

  public SparseVector[] computeFeatureVectors(RDFDataSet dataset, List<Resource> instances, List<Statement> blackList) {
    SparseVector[] featureVectors = new SparseVector[instances.size()];
    for (int i = 0; i < featureVectors.length; i++) {
      featureVectors[i] = new SparseVector();
   

    DirectedGraph<Vertex<Map<Integer,String>>,Edge<Map<Integer,String>>> graph = createGraphFromRDF(dataset, instances, blackList);
    createInstanceIndexMaps(graph, instances);
View Full Code Here

    }
    return ret;
  }
 
  private SparseVector processVertex(Resource root) {
    SparseVector features = new SparseVector();
    processVertexRec(root, new ArrayList<Integer>(), features, depth, root);
    if (probabilities) {
      features = normalizeFeatures(features);
    }
    return features;
View Full Code Here

    }
    return features;
  }
 
  private SparseVector normalizeFeatures(SparseVector features) {
    SparseVector res = new SparseVector();
    for (int key : features.getIndices()) {
      List<Integer> path = index2path.get(key);
      if (path.size()==0) {
        res.setValue(key, 1.0);
      } else {
        List<Integer> parent = path.subList(0, path.size()-pathLen);
        int parentKey = path2index.get(parent);
        res.setValue(key, features.getValue(key)/features.getValue(parentKey));
      }
    }
    return res;
  }
View Full Code Here


  public SparseVector[] computeFeatureVectors(RDFDataSet dataset, List<Resource> instances, List<Statement> blackList) {
    SparseVector[] featureVectors = new SparseVector[instances.size()];
    for (int i = 0; i < featureVectors.length; i++) {
      featureVectors[i] = new SparseVector();
   

    DirectedGraph<Vertex<Map<Integer,StringBuilder>>,Edge<Map<Integer,StringBuilder>>> graph = createGraphFromRDF(dataset, instances, blackList);
    createInstanceIndexMaps(graph, instances);
View Full Code Here

  public SparseVector[] computeFeatureVectors(
      List<DirectedMultigraphWithRoot<Vertex<String>, Edge<String>>> trainGraphs) {
    List<DirectedMultigraphWithRoot<Vertex<StringBuilder>, Edge<StringBuilder>>> graphs = copyGraphs(trainGraphs);
    SparseVector[] featureVectors = new SparseVector[graphs.size()];
    for (int i = 0; i < featureVectors.length; i++) {
      featureVectors[i] = new SparseVector();
   
    //double[][] featureVectors = new double[graphs.size()][];
    Map<String, String> labelDict = new HashMap<String,String>();

    int startLabel = 1;
View Full Code Here

    List<DirectedMultigraphWithRoot<Vertex<StringBuilder>, Edge<StringBuilder>>> graphs = copyGraphs(testGraphs);
    graphs.addAll(copyGraphs(trainGraphs));
    SparseVector[] featureVectors = new SparseVector[graphs.size()];
    for (int i = 0; i < featureVectors.length; i++) {
      featureVectors[i] = new SparseVector();
   
    //double[][] featureVectors = new double[graphs.size()][];
    Map<String, String> labelDict = new HashMap<String,String>();
    double[][] kernel = KernelUtils.initMatrix(testGraphs.size(), trainGraphs.size());
    double[] ss = new double[testGraphs.size() + trainGraphs.size()];
View Full Code Here

TOP

Related Classes of org.data2semantics.proppred.learners.SparseVector

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.