本文整理了Java中de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.KMeans.setK()
方法的一些代码示例,展示了KMeans.setK()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KMeans.setK()
方法的具体详情如下:
包路径:de.lmu.ifi.dbs.elki.algorithm.clustering.kmeans.KMeans
类名称:KMeans
方法名:setK
[英]Set the value of k. Needed for some types of nested k-means.
[中]设置某些类型的嵌套k-均值所需的k值。
代码示例来源:origin: elki-project/elki
@Override
public void setK(int k) {
innerkMeans.setK(k);
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-clustering
@Override
public void setK(int k) {
innerkMeans.setK(k);
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
@Override
public void setK(int k) {
innerkMeans.setK(k);
}
代码示例来源:origin: elki-project/elki
innerKMeans.setK(k_min);
LOG.statistics(new StringStatistic(KEY + ".initialization", initializer.toString()));
splitInitializer.setInitialMeans(initializer.chooseInitialMeans(database, relation, k_min, getDistanceFunction()));
innerKMeans.setK(nextClusters.size());
clustering = innerKMeans.run(database, relation);
clusters.clear();
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-clustering
innerKMeans.setK(k_min);
LOG.statistics(new StringStatistic(KEY + ".initialization", initializer.toString()));
splitInitializer.setInitialMeans(initializer.chooseInitialMeans(database, relation, k_min, getDistanceFunction()));
innerKMeans.setK(nextClusters.size());
clustering = innerKMeans.run(database, relation);
clusters.clear();
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
innerKMeans.setK(k_min);
if(LOG.isStatistics()) {
LOG.statistics(new StringStatistic(KEY + ".initialization", initializer.toString()));
innerKMeans.setK(nextClusters.size());
clustering = innerKMeans.run(database, relation);
clusters.clear();
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
@Override
public <T extends V, O extends NumberVector> List<O> chooseInitialMeans(Database database, Relation<T> relation, int k, NumberVectorDistanceFunction<? super T> distanceFunction, NumberVector.Factory<O> factory) {
final DBIDs sample = DBIDUtil.randomSample(relation.getDBIDs(), rate, rnd);
// Ugly cast, sorry
@SuppressWarnings("unchecked")
Relation<V> rel = (Relation<V>) relation;
// FIXME: This does not necessarily hold. Check and fail!
if(!distanceFunction.getInputTypeRestriction().isAssignableFromType(TypeUtil.NUMBER_VECTOR_FIELD)) {
LoggingUtil.warning("Initializing k-means with k-means using specialized distance functions MAY fail, if the initialization method does require a distance defined on arbitrary number vectors.");
}
@SuppressWarnings("unchecked")
NumberVectorDistanceFunction<? super V> pdf = (NumberVectorDistanceFunction<? super V>) distanceFunction;
ProxyView<V> proxyv = new ProxyView<>(sample, rel);
ProxyDatabase proxydb = new ProxyDatabase(sample, proxyv);
innerkMeans.setK(k);
innerkMeans.setDistanceFunction(pdf);
Clustering<?> clusters = innerkMeans.run(proxydb, proxyv);
List<O> means = new ArrayList<>();
for(Cluster<?> cluster : clusters.getAllClusters()) {
means.add(factory.newNumberVector(ModelUtil.getPrototype(cluster.getModel(), relation)));
}
return means;
}
代码示例来源:origin: elki-project/elki
@Override
public double[][] chooseInitialMeans(Database database, Relation<? extends NumberVector> relation, int k, NumberVectorDistanceFunction<?> distanceFunction) {
if(relation.size() < k) {
throw new IllegalArgumentException("Cannot choose k=" + k + " means from N=" + relation.size() + " < k objects.");
}
final DBIDs sample = DBIDUtil.randomSample(relation.getDBIDs(), rate, rnd);
if(sample.size() < k) {
throw new IllegalArgumentException("Sampling rate=" + rate + " from N=" + relation.size() + " yields only " + sample.size() + " < k objects.");
}
// Ugly cast, sorry
@SuppressWarnings("unchecked")
Relation<V> rel = (Relation<V>) relation;
// FIXME: This does not necessarily hold. Check and fail!
if(!distanceFunction.getInputTypeRestriction().isAssignableFromType(TypeUtil.NUMBER_VECTOR_FIELD)) {
LoggingUtil.warning("Initializing k-means with k-means using specialized distance functions MAY fail, if the initialization method does require a distance defined on arbitrary number vectors.");
}
@SuppressWarnings("unchecked")
NumberVectorDistanceFunction<? super V> pdf = (NumberVectorDistanceFunction<? super V>) distanceFunction;
ProxyView<V> proxyv = new ProxyView<>(sample, rel);
ProxyDatabase proxydb = new ProxyDatabase(sample, proxyv);
innerkMeans.setK(k);
innerkMeans.setDistanceFunction(pdf);
Clustering<?> clusters = innerkMeans.run(proxydb, proxyv);
double[][] means = new double[clusters.getAllClusters().size()][];
int i = 0;
for(Cluster<?> cluster : clusters.getAllClusters()) {
means[i++] = ModelUtil.getPrototype(cluster.getModel(), relation).toArray();
}
return means;
}
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-clustering
@Override
public double[][] chooseInitialMeans(Database database, Relation<? extends NumberVector> relation, int k, NumberVectorDistanceFunction<?> distanceFunction) {
if(relation.size() < k) {
throw new IllegalArgumentException("Cannot choose k=" + k + " means from N=" + relation.size() + " < k objects.");
}
final DBIDs sample = DBIDUtil.randomSample(relation.getDBIDs(), rate, rnd);
if(sample.size() < k) {
throw new IllegalArgumentException("Sampling rate=" + rate + " from N=" + relation.size() + " yields only " + sample.size() + " < k objects.");
}
// Ugly cast, sorry
@SuppressWarnings("unchecked")
Relation<V> rel = (Relation<V>) relation;
// FIXME: This does not necessarily hold. Check and fail!
if(!distanceFunction.getInputTypeRestriction().isAssignableFromType(TypeUtil.NUMBER_VECTOR_FIELD)) {
LoggingUtil.warning("Initializing k-means with k-means using specialized distance functions MAY fail, if the initialization method does require a distance defined on arbitrary number vectors.");
}
@SuppressWarnings("unchecked")
NumberVectorDistanceFunction<? super V> pdf = (NumberVectorDistanceFunction<? super V>) distanceFunction;
ProxyView<V> proxyv = new ProxyView<>(sample, rel);
ProxyDatabase proxydb = new ProxyDatabase(sample, proxyv);
innerkMeans.setK(k);
innerkMeans.setDistanceFunction(pdf);
Clustering<?> clusters = innerkMeans.run(proxydb, proxyv);
double[][] means = new double[clusters.getAllClusters().size()][];
int i = 0;
for(Cluster<?> cluster : clusters.getAllClusters()) {
means[i++] = ModelUtil.getPrototype(cluster.getModel(), relation).toArray();
}
return means;
}
代码示例来源:origin: elki-project/elki
innerKMeans.setK(2);
Clustering<M> childClustering = innerKMeans.run(proxyDB);
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-clustering
innerKMeans.setK(2);
Clustering<M> childClustering = innerKMeans.run(proxyDB);
代码示例来源:origin: de.lmu.ifi.dbs.elki/elki
innerKMeans.setK(2);
Clustering<M> childClustering = innerKMeans.run(proxyDB);
内容来源于网络,如有侵权,请联系作者删除!