@Override public int numDimensions() { return data[0].length(); } };
@Override public String toString() { String str = ""; str += "ByteCentroidsResult" + "\n"; str += "No. of Clusters: " + centroids.length + "\n"; str += "No. of Dimensions: " + centroids[0].length() + "\n"; return str; }
@Override public int numDimensions() { return centroids[0].length(); }
@Override public int numDimensions() { return data[0].length(); } };
/** * Construct the assigner using the given cluster data and distance * function. * * @param data * the cluster data * @param comparison * the distance function */ @SuppressWarnings("unchecked") public ExactFeatureVectorAssigner(List<T> data, DistanceComparator<? super T> comparison) { nn = new ObjectNearestNeighboursExact<T>(data, comparison); this.ndims = data.get(0).length(); this.clz = (Class<T>) data.get(0).getClass(); }
/** * Construct the assigner using the given cluster data and distance * function. * * @param data * the cluster data * @param comparison * the distance function */ @SuppressWarnings("unchecked") public ExactFeatureVectorAssigner(T[] data, DistanceComparator<? super T> comparison) { nn = new ObjectNearestNeighboursExact<T>(data, comparison); this.ndims = data[0].length(); this.clz = (Class<T>) data.getClass().getComponentType(); }
/** * Construct the assigner using the given cluster data and distance * function. * * @param provider * the cluster data provider * @param comparison * the distance function */ @SuppressWarnings("unchecked") public ExactFeatureVectorAssigner(CentroidsProvider<T> provider, DistanceComparator<? super T> comparison) { final T[] centroids = provider.getCentroids(); nn = new ObjectNearestNeighboursExact<T>(centroids, comparison); this.ndims = centroids[0].length(); this.clz = (Class<T>) centroids.getClass().getComponentType(); }
/** * Reset the internal feature vector length to the length of the first * feature. You must call this if you change the length of the features * within the list. */ public void resetVecLength() { if (size() > 0) { cached_veclen = get(0).getFeatureVector().length(); } }
/** * Reset the internal feature vector length to the length of the first * feature. You must call this if you change the length of the features * within the list. */ public void resetVecLength() { if (size() > 0) { cached_veclen = get(0).getFeatureVector().length(); } }
/** * Construct a local feature list from the given collection of local * features. * * @param c * Collection of local feature to add to the list instance. */ public MemoryLocalFeatureList(Collection<? extends T> c) { super(c); if (size() > 0) cached_veclen = this.get(0).getFeatureVector().length(); }
/** * Construct a local feature list from the given collection of local * features. * * @param c * Collection of local feature to add to the list instance. */ public MemoryLocalFeatureList(Collection<? extends T> c) { super(c); if (size() > 0) cached_veclen = this.get(0).getFeatureVector().length(); }
@Override public int vecLength() { resetVecLength(); if (cached_veclen == -1) { if (size() > 0) { cached_veclen = get(0).getFeatureVector().length(); } } return cached_veclen; }
@Override public int vecLength() { resetVecLength(); if (cached_veclen == -1) { if (size() > 0) { cached_veclen = get(0).getFeatureVector().length(); } } return cached_veclen; }
annotationsList = new ArrayList<ANNOTATION>(annotations); final int featureLength = extractor.extractFeature(data.get(0).getObject()).length();
final int featureLength = extractor.extractFeature(data.get(0).getObject()).length();
@Override public Boolean call() { try { final int D = ds.getData(0).length(); final T[] points = ds.createTemporaryArray(stopRow - startRow); ds.getData(startRow, stopRow, points); final int[] argmins = new int[points.length]; final float[] mins = new float[points.length]; nno.searchNN(points, argmins, mins); synchronized (centroids_accum) { for (int i = 0; i < points.length; ++i) { final int k = argmins[i]; final double[] vector = points[i].asDoubleVector(); for (int d = 0; d < D; ++d) { centroids_accum[k][d] += vector[d]; } counts[k] += 1; } } } catch (final Exception e) { e.printStackTrace(); } return true; } }
final T[] centroids = result.centroids; final int K = centroids.length; final int D = centroids[0].length(); final int N = data.size(); final double[][] centroids_accum = new double[K][D];
final int featureLength = extractor.extractFeature(dataset.getRandomInstance()).length();
out[out.length - 1] = new FeatureNode(feature.length() + 1, bias);