Package net.myrrix.online.generation

Examples of net.myrrix.online.generation.IDCluster


                                     Lock clustersReadLock) {
    if (featureVector == null || clusters == null || clusters.isEmpty()) {
      return;
    }
   
    IDCluster closestCentroid;
    clustersReadLock.lock();
    try {
      closestCentroid = findClosestCentroid(featureVector, clusters);
    } finally {
      clustersReadLock.unlock();
    }
   
    if (closestCentroid == null) {
      return;
    }

    FastIDSet newMembers = closestCentroid.getMembers();
   
    boolean removeFromCurrentCluster;       
    synchronized (newMembers) {
      // Wasn't already present, so was present elsewhere; find and remove it       
      removeFromCurrentCluster = newMembers.add(id);
View Full Code Here


    }
  }
 
  private static IDCluster findClosestCentroid(float[] vector, Iterable<IDCluster> clusters) {
    double vectorNorm = SimpleVectorMath.norm(vector);
    IDCluster closestCentroid = null;
    double highestDot = Double.NEGATIVE_INFINITY;
    for (IDCluster cluster : clusters) {
      double dot = SimpleVectorMath.dot(cluster.getCentroid(), vector) / cluster.getCentroidNorm() / vectorNorm;
      if (LangUtils.isFinite(dot) && dot > highestDot) {
        highestDot = dot;
View Full Code Here

TOP

Related Classes of net.myrrix.online.generation.IDCluster

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.