Package org.apache.mahout.clustering.spectral.common

Examples of org.apache.mahout.clustering.spectral.common.VertexWritable


      // and (3, 3) (which, incidentally, will also not be grouped together)
      String type = context.getWorkingDirectory().getName();
      Vector vector = row.get();
      for (Vector.Element e : vector) {
        String newkey = Math.max(key.get(), e.index()) + "_" + Math.min(key.get(), e.index());
        context.write(new Text(newkey), new VertexWritable(key.get(), e.index(), e.get(), type));
      }
    }
View Full Code Here


        List<VertexWritable> toAdd = new ArrayList<VertexWritable>();
        if (map.containsKey(key)) {
          toAdd = map.get(key);
          map.remove(key);
        }
        toAdd.add(new VertexWritable(i, j, this.affinity[i][j], affinity.getName()));
        toAdd.add(new VertexWritable(i, j, array[i][j], sensitivity.getName()));
        map.put(key, toAdd);
      }
    }
    return map;
  }
View Full Code Here

      // if there are only two vertices, we have a diagonal
      // we want to preserve whatever is currently in the diagonal,
      // since this is acting as a running sum of all other values
      // that have been "cut" so far - simply return this element as is
      if (count == 2) {
        VertexWritable vw = new VertexWritable(i, j, k, "unimportant");
        context.write(new Text(String.valueOf(i)), vw);
        return;
      }
     
      // do we zero out the values?
      VertexWritable out_i = new VertexWritable();
      VertexWritable out_j = new VertexWritable();
      if (zero) {
        // increment the cut counter
        context.getCounter(CUTSCOUNTER.NUM_CUTS).increment(1);
       
        // we want the values to exist on the diagonal
        out_i.setCol(i);
        out_j.setCol(j);
       
        // also, set the old values to zero
        VertexWritable zero_i = new VertexWritable();
        VertexWritable zero_j = new VertexWritable();
        zero_i.setCol(j);
        zero_i.setValue(0);
        zero_j.setCol(i);
        zero_j.setValue(0);
        zero_i.setType("unimportant");
        zero_j.setType("unimportant");
        context.write(new Text(String.valueOf(i)), zero_i);
        context.write(new Text(String.valueOf(j)), zero_j);
      } else {
        out_i.setCol(j);
        out_j.setCol(i);
View Full Code Here

      // and (3, 3) (which, incidentally, will also not be grouped together)
      String type = context.getWorkingDirectory().getName();
      Vector vector = row.get();
      for (Vector.Element e : vector.all()) {
        String newkey = Math.max(key.get(), e.index()) + "_" + Math.min(key.get(), e.index());
        context.write(new Text(newkey), new VertexWritable(key.get(), e.index(), e.get(), type));
      }
    }
View Full Code Here

      // if there are only two vertices, we have a diagonal
      // we want to preserve whatever is currently in the diagonal,
      // since this is acting as a running sum of all other values
      // that have been "cut" so far - simply return this element as is
      if (count == 2) {
        VertexWritable vw = new VertexWritable(i, j, k, "unimportant");
        context.write(new Text(String.valueOf(i)), vw);
        return;
      }
     
      // do we zero out the values?
      VertexWritable outI = new VertexWritable();
      VertexWritable outJ = new VertexWritable();
      if (zero) {
        // increment the cut counter
        context.getCounter(CUTSCOUNTER.NUM_CUTS).increment(1);
       
        // we want the values to exist on the diagonal
        outI.setCol(i);
        outJ.setCol(j);
       
        // also, set the old values to zero
        VertexWritable zeroI = new VertexWritable();
        VertexWritable zeroJ = new VertexWritable();
        zeroI.setCol(j);
        zeroI.setValue(0);
        zeroJ.setCol(i);
        zeroJ.setValue(0);
        zeroI.setType("unimportant");
        zeroJ.setType("unimportant");
        context.write(new Text(String.valueOf(i)), zeroI);
        context.write(new Text(String.valueOf(j)), zeroJ);
      } else {
        outI.setCol(j);
        outJ.setCol(i);
View Full Code Here

        List<VertexWritable> toAdd = Lists.newArrayList();
        if (map.containsKey(key)) {
          toAdd = map.get(key);
          map.remove(key);
        }
        toAdd.add(new VertexWritable(i, j, this.affinity[i][j], affinity.getName()));
        toAdd.add(new VertexWritable(i, j, array[i][j], sensitivity.getName()));
        map.put(key, toAdd);
      }
    }
    return map;
  }
View Full Code Here

      // and (3, 3) (which, incidentally, will also not be grouped together)
      String type = context.getWorkingDirectory().getName();
      Vector vector = row.get();
      for (Vector.Element e : vector) {
        String newkey = Math.max(key.get(), e.index()) + "_" + Math.min(key.get(), e.index());
        context.write(new Text(newkey), new VertexWritable(key.get(), e.index(), e.get(), type));
      }
    }
View Full Code Here

      // if there are only two vertices, we have a diagonal
      // we want to preserve whatever is currently in the diagonal,
      // since this is acting as a running sum of all other values
      // that have been "cut" so far - simply return this element as is
      if (count == 2) {
        VertexWritable vw = new VertexWritable(i, j, k, "unimportant");
        context.write(new Text(String.valueOf(i)), vw);
        return;
      }
     
      // do we zero out the values?
      VertexWritable outI = new VertexWritable();
      VertexWritable outJ = new VertexWritable();
      if (zero) {
        // increment the cut counter
        context.getCounter(CUTSCOUNTER.NUM_CUTS).increment(1);
       
        // we want the values to exist on the diagonal
        outI.setCol(i);
        outJ.setCol(j);
       
        // also, set the old values to zero
        VertexWritable zeroI = new VertexWritable();
        VertexWritable zeroJ = new VertexWritable();
        zeroI.setCol(j);
        zeroI.setValue(0);
        zeroJ.setCol(i);
        zeroJ.setValue(0);
        zeroI.setType("unimportant");
        zeroJ.setType("unimportant");
        context.write(new Text(String.valueOf(i)), zeroI);
        context.write(new Text(String.valueOf(j)), zeroJ);
      } else {
        outI.setCol(j);
        outJ.setCol(i);
View Full Code Here

        List<VertexWritable> toAdd = new ArrayList<VertexWritable>();
        if (map.containsKey(key)) {
          toAdd = map.get(key);
          map.remove(key);
        }
        toAdd.add(new VertexWritable(i, j, this.affinity[i][j], affinity.getName()));
        toAdd.add(new VertexWritable(i, j, array[i][j], sensitivity.getName()));
        map.put(key, toAdd);
      }
    }
    return map;
  }
View Full Code Here

      // and (3, 3) (which, incidentally, will also not be grouped together)
      String type = context.getWorkingDirectory().getName();
      Vector vector = row.get();
      for (Vector.Element e : vector) {
        String newkey = Math.max(key.get(), e.index()) + "_" + Math.min(key.get(), e.index());
        context.write(new Text(newkey), new VertexWritable(key.get(), e.index(), e.get(), type));
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.mahout.clustering.spectral.common.VertexWritable

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.