本文整理汇总了Java中com.rapidminer.operator.clustering.Cluster.getExampleIds方法的典型用法代码示例。如果您正苦于以下问题:Java Cluster.getExampleIds方法的具体用法?Java Cluster.getExampleIds怎么用?Java Cluster.getExampleIds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.rapidminer.operator.clustering.Cluster
的用法示例。
在下文中一共展示了Cluster.getExampleIds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: logLikelihoodEstimate
import com.rapidminer.operator.clustering.Cluster; //导入方法依赖的package包/类
private double logLikelihoodEstimate(Cluster c, double[] centroid, int[] as, int K) {
double l = 0;
double R = examplesize;
double Rn = c.getNumberOfExamples();
double M = dimension;
double d = 0;
double[] values = new double[attributes.size()];
if (Rn > 1) {
double sum = 0;
final Attribute idAttribute = exampleSet.getAttributes().getId();
boolean idIsNominal = idAttribute.isNominal();
exampleSet.remapIds();
for (Object ob : c.getExampleIds()) {
Example example;
if (idIsNominal) {
example = exampleSet.getExampleFromId(idAttribute.getMapping().mapString((String) ob));
} else {
example = exampleSet.getExampleFromId(((Double) ob).intValue());
}
if (example == null) {
throw new RuntimeException("Unknown id: " + ob);
}
sum += Math.pow(measure.calculateDistance(centroid, getAsDoubleArray(example, attributes, values)), 2);
}
d = 1.0 / (Rn - K) * sum;
l = -(Rn / 2.0) * Math.log(2.0 * Math.PI) - Rn * M / 2.0 * Math.log(d) - (Rn - K) / 2.0 + Rn * Math.log(Rn) - Rn
* Math.log(R);
}
return l;
}
示例2: generateFlatModel
import com.rapidminer.operator.clustering.Cluster; //导入方法依赖的package包/类
private DefaultMutableTreeNode generateFlatModel(ClusterModel cm) {
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("root");
rootNode.setAllowsChildren(true);
for (int i = 0; i < cm.getNumberOfClusters(); i++) {
Cluster cl = cm.getCluster(i);
DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(cl);
newNode.setAllowsChildren(true);
rootNode.add(newNode);
for (Object exampleId : cl.getExampleIds()) {
newNode.add(createLeaf(exampleId));
}
}
return rootNode;
}
示例3: logLikelihoodEstimate
import com.rapidminer.operator.clustering.Cluster; //导入方法依赖的package包/类
private double logLikelihoodEstimate(Cluster c, double[] centroid, int K) {
double l = 0;
double R = examplesize;
double Rn = c.getNumberOfExamples();
double M = dimension;
double d = 0;
double[] values = new double[attributes.size()];
if (Rn > 1) {
double sum = 0;
final Attribute idAttribute = exampleSet.getAttributes().getId();
boolean idIsNominal = idAttribute.isNominal();
exampleSet.remapIds();
for (Object ob : c.getExampleIds()) {
Example example;
if (idIsNominal) {
example = exampleSet.getExampleFromId(idAttribute.getMapping().mapString((String) ob));
} else {
example = exampleSet.getExampleFromId(((Double) ob).intValue());
}
if (example == null) {
throw new RuntimeException("Unknown id: " + ob);
}
sum += Math.pow(measure.calculateDistance(centroid, getAsDoubleArray(example, attributes, values)), 2);
}
d = 1.0 / (Rn - K) * sum;
l = -(Rn / 2.0) * Math.log(2.0 * Math.PI) - Rn * M / 2.0 * Math.log(d) - (Rn - K) / 2.0 + Rn * Math.log(Rn)
- Rn * Math.log(R);
}
return l;
}
示例4: logLikelihoodEstimate
import com.rapidminer.operator.clustering.Cluster; //导入方法依赖的package包/类
private double logLikelihoodEstimate(Cluster c, double[] centroid,
int[] as, int K) {
double l = 0;
double R = examplesize;
double Rn = c.getNumberOfExamples();
double M = dimension;
double d = 0;
double[] values = new double[attributes.size()];
if (Rn > 1) {
double sum = 0;
final Attribute idAttribute = exampleSet.getAttributes().getId();
boolean idIsNominal = idAttribute.isNominal();
exampleSet.remapIds();
for (Object ob : c.getExampleIds()) {
Example example;
if (idIsNominal) {
example = exampleSet.getExampleFromId(idAttribute.getMapping().mapString((String)ob));
} else {
example = exampleSet.getExampleFromId(((Double) ob).intValue());
}
if (example == null) {
throw new RuntimeException("Unknown id: "+ob);
}
sum += Math.pow((measure.calculateDistance(
centroid,
getAsDoubleArray(example, attributes,
values))), 2);
}
d = (1.0 / (Rn - K)) * sum;
l = -(Rn / 2.0) * Math.log(2.0 * Math.PI) - ((Rn * M) / 2.0)
* Math.log(d) - (Rn - K) / 2.0 + Rn * Math.log(Rn) - Rn
* Math.log(R);
}
return l;
}
示例5: generateFlatModel
import com.rapidminer.operator.clustering.Cluster; //导入方法依赖的package包/类
private DefaultMutableTreeNode generateFlatModel(ClusterModel cm) {
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("root");
rootNode.setAllowsChildren(true);
for (int i = 0; i < cm.getNumberOfClusters(); i++) {
Cluster cl = cm.getCluster(i);
DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(cl);
newNode.setAllowsChildren(true);
rootNode.add(newNode);
for (Object exampleId: cl.getExampleIds()) {
newNode.add(createLeaf(exampleId));
}
}
return rootNode;
}