Package image.processing.patterns.cluster

Examples of image.processing.patterns.cluster.DoubleArray


        }
        // add the value to the current vector
        vector[i] = value;
      }
      // add the vector to the list of vectors
      vectors.add(new DoubleArray(vector, vectorCount));
                        vectorCount++;
    }
    // close the file
    reader.close();
               
    // Create a list of clusters
    clusters = new ArrayList<Cluster>();
   
    // Get the size of vectors
    int vectorsSize = vectors.get(0).data.length;
               
    // SPECIAL CASE: If only one vector
    if (vectors.size() == 1) {
      // Create a single cluster and return it
      DoubleArray vector = vectors.get(0);
      Cluster cluster = new Cluster(vectorsSize);
      cluster.addVector(vector);
      clusters.add(cluster);
      return clusters;
    }
   
    // (1) Randomly generate k empty clusters with a random mean (cluster
    // center)
    for(int i=0; i< k; i++){
      DoubleArray meanVector = generateRandomVector(minValue, maxValue, vectorsSize);
      Cluster cluster = new Cluster(vectorsSize);
      cluster.setMean(meanVector);
      clusters.add(cluster);
    }
View Full Code Here


    // for each position generate a random number
    for(int i=0; i < vectorsSize; i++){
      vector[i] = (random.nextDouble() * (maxValue - minValue)) + minValue;
    }
    // return the vector
    return new DoubleArray(vector, 0);
  }
View Full Code Here

//        System.out.println("val");
      }
      // create a DoubleArray object with the vector
                        System.out.println("Image Number: " + vectorCount);
                        System.out.println(line);
      DoubleArray theVector = new DoubleArray(vector, vectorCount);
                        vectorCount++;
     
      // Initiallly we create a cluster for each vector
      Cluster cluster = new Cluster(vector.length);
      cluster.addVector(theVector);
      cluster.setMean(theVector.clone());
      clusters.add(cluster);
    }
    reader.close(); // close the input file

    // (2) Loop to combine the two closest clusters into a bigger cluster
View Full Code Here

        }
        // add the value to the current vector
        vector[i] = value;
      }
      // add the vector to the list of vectors
      vectors.add(new DoubleArray(vector, vectorCount));
                        vectorCount++;
    }
    // close the file
    reader.close();
               
    // Create a list of clusters
    clusters = new ArrayList<Cluster>();
   
    // Get the size of vectors
    int vectorsSize = vectors.get(0).data.length;
    System.out.println("Vector size: " + vectors.size());
    // SPECIAL CASE: If only one vector
    if (vectors.size() == 1) {
      // Create a single cluster and return it
      DoubleArray vector = vectors.get(0);
      Cluster cluster = new Cluster(vectorsSize);
      cluster.addVector(vector);
      clusters.add(cluster);
      return clusters;
    }
   
    // (1) Randomly generate k empty clusters with a random mean (cluster
    // center)
    for(int i=0; i< k; i++){
                        int rand = 0 + (int)(Math.random() * vectors.size()-1);
      DoubleArray meanVector = vectors.get(rand);
      Cluster cluster = new Cluster(vectorsSize);
      cluster.setMean(meanVector);
      clusters.add(cluster);
    }

View Full Code Here

    // for each position generate a random number
    for(int i=0; i < vectorsSize; i++){
      vector[i] = (random.nextDouble() * (maxValue - minValue)) + minValue;
    }
    // return the vector
    return new DoubleArray(vector, 0);
  }
View Full Code Here

TOP

Related Classes of image.processing.patterns.cluster.DoubleArray

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.