- Common ways to obtain ORCLUS$ProjectedEnergy
private void myMethod () {ORCLUS$ProjectedEnergy o =
ORCLUS oRCLUS;ORCLUS.ORCLUSCluster oRCLUSORCLUSCluster;new ProjectedEnergy(oRCLUS, int1, int2, oRCLUSORCLUSCluster)
- Smart code suggestions by Codota
}
/** * Computes the projected energy of the specified clusters. The projected * energy is given by the mean square distance of the points to the centroid * of the union cluster c, when all points in c are projected to the subspace * of c. * * @param relation the relation holding the objects * @param c_i the first cluster * @param c_j the second cluster * @param i the index of cluster c_i in the cluster list * @param j the index of cluster c_j in the cluster list * @param dim the dimensionality of the clusters * @return the projected energy of the specified cluster */ private ProjectedEnergy projectedEnergy(Relation<V> relation, ORCLUSCluster c_i, ORCLUSCluster c_j, int i, int j, int dim) { NumberVectorDistanceFunction<? super V> distFunc = SquaredEuclideanDistanceFunction.STATIC; // union of cluster c_i and c_j ORCLUSCluster c_ij = union(relation, c_i, c_j, dim); double sum = 0.; NumberVector c_proj = DoubleVector.wrap(project(c_ij, c_ij.centroid)); for(DBIDIter iter = c_ij.objectIDs.iter(); iter.valid(); iter.advance()) { NumberVector o_proj = DoubleVector.wrap(project(c_ij, relation.get(iter).toArray())); sum += distFunc.distance(o_proj, c_proj); } sum /= c_ij.objectIDs.size(); return new ProjectedEnergy(i, j, c_ij, sum); }
/** * Computes the projected energy of the specified clusters. The projected * energy is given by the mean square distance of the points to the centroid * of the union cluster c, when all points in c are projected to the subspace * of c. * * @param relation the relation holding the objects * @param c_i the first cluster * @param c_j the second cluster * @param i the index of cluster c_i in the cluster list * @param j the index of cluster c_j in the cluster list * @param dim the dimensionality of the clusters * @return the projected energy of the specified cluster */ private ProjectedEnergy projectedEnergy(Relation<V> relation, ORCLUSCluster c_i, ORCLUSCluster c_j, int i, int j, int dim) { NumberVectorDistanceFunction<? super V> distFunc = SquaredEuclideanDistanceFunction.STATIC; // union of cluster c_i and c_j ORCLUSCluster c_ij = union(relation, c_i, c_j, dim); double sum = 0.; NumberVector c_proj = DoubleVector.wrap(project(c_ij, c_ij.centroid)); for(DBIDIter iter = c_ij.objectIDs.iter(); iter.valid(); iter.advance()) { NumberVector o_proj = DoubleVector.wrap(project(c_ij, relation.get(iter).toArray())); sum += distFunc.distance(o_proj, c_proj); } sum /= c_ij.objectIDs.size(); return new ProjectedEnergy(i, j, c_ij, sum); }
/** * Computes the projected energy of the specified clusters. The projected * energy is given by the mean square distance of the points to the centroid * of the union cluster c, when all points in c are projected to the subspace * of c. * * @param database the database holding the objects * @param distFunc the distance function * @param c_i the first cluster * @param c_j the second cluster * @param i the index of cluster c_i in the cluster list * @param j the index of cluster c_j in the cluster list * @param dim the dimensionality of the clusters * @return the projected energy of the specified cluster */ private ProjectedEnergy projectedEnergy(Relation<V> database, DistanceQuery<V> distFunc, ORCLUSCluster c_i, ORCLUSCluster c_j, int i, int j, int dim) { // union of cluster c_i and c_j ORCLUSCluster c_ij = union(database, distFunc, c_i, c_j, dim); NumberVector.Factory<V> factory = RelationUtil.getNumberVectorFactory(database); double sum = 0.; V c_proj = projection(c_ij, c_ij.centroid, factory); for(DBIDIter iter = c_ij.objectIDs.iter(); iter.valid(); iter.advance()) { V o_proj = projection(c_ij, database.get(iter), factory); double dist = distFunc.distance(o_proj, c_proj); sum += dist * dist; } sum /= c_ij.objectIDs.size(); return new ProjectedEnergy(i, j, c_ij, sum); }