本文整理汇总了Java中com.rapidminer.operator.clustering.HierarchicalClusterModel类的典型用法代码示例。如果您正苦于以下问题:Java HierarchicalClusterModel类的具体用法?Java HierarchicalClusterModel怎么用?Java HierarchicalClusterModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HierarchicalClusterModel类属于com.rapidminer.operator.clustering包,在下文中一共展示了HierarchicalClusterModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TopDownClustering
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
public TopDownClustering(OperatorDescription description) {
super(description, "Clustering Process");
exampleSetInput.addPrecondition(new SimplePrecondition(exampleSetInput, new ExampleSetMetaData()));
getTransformer().addRule(new PassThroughRule(exampleSetInput, exampleSetInnerSource, false));
getTransformer().addRule(new SubprocessTransformRule(getSubprocess(0)));
modelInnerSink.addPrecondition(new SimplePrecondition(modelInnerSink, new MetaData(ClusterModel.class)));
getTransformer().addRule(new ExampleSetPassThroughRule(exampleSetInput, exampleSetOutput, SetRelation.EQUAL) {
@Override
public ExampleSetMetaData modifyExampleSet(ExampleSetMetaData metaData) {
if (addsClusterAttribute()) {
metaData.addAttribute(new AttributeMetaData(Attributes.CLUSTER_NAME, Ontology.NOMINAL,
Attributes.CLUSTER_NAME));
}
MetaDataTools.checkAndCreateIds(metaData);
return metaData;
}
});
getTransformer().addRule(new GenerateNewMDRule(modelOutput, new MetaData(HierarchicalClusterModel.class)));
}
示例2: AgglomerativeClustering
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
public AgglomerativeClustering(OperatorDescription description) {
super(description);
exampleSetInput.addPrecondition(new DistanceMeasurePrecondition(exampleSetInput, this));
exampleSetInput.addPrecondition(new CapabilityPrecondition(this, exampleSetInput));
getTransformer().addRule(new GenerateNewMDRule(modelOutput, new MetaData(HierarchicalClusterModel.class)));
getTransformer().addRule(new ExampleSetPassThroughRule(exampleSetInput, exampleSetOutput, SetRelation.EQUAL) {
@Override
public ExampleSetMetaData modifyExampleSet(ExampleSetMetaData metaData) {
metaData.addAttribute(new AttributeMetaData(Attributes.ID_NAME, Ontology.INTEGER, Attributes.ID_NAME));
return metaData;
}
});
}
示例3: TopDownClustering
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
public TopDownClustering(OperatorDescription description) {
super(description, "Clustering Process");
exampleSetInput.addPrecondition(new SimplePrecondition(exampleSetInput, new ExampleSetMetaData()));
getTransformer().addRule(new PassThroughRule(exampleSetInput, exampleSetInnerSource, false));
getTransformer().addRule(new SubprocessTransformRule(getSubprocess(0)));
modelInnerSink.addPrecondition(new SimplePrecondition(modelInnerSink, new MetaData(ClusterModel.class)));
getTransformer().addRule(new ExampleSetPassThroughRule(exampleSetInput, exampleSetOutput, SetRelation.EQUAL) {
@Override
public ExampleSetMetaData modifyExampleSet(ExampleSetMetaData metaData) {
if (addsClusterAttribute()) {
metaData.addAttribute(
new AttributeMetaData(Attributes.CLUSTER_NAME, Ontology.NOMINAL, Attributes.CLUSTER_NAME));
}
MetaDataTools.checkAndCreateIds(metaData);
return metaData;
}
});
getTransformer().addRule(new GenerateNewMDRule(modelOutput, new MetaData(HierarchicalClusterModel.class)));
}
示例4: TopDownClustering
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
public TopDownClustering(OperatorDescription description) {
super(description, "Clustering Process");
exampleSetInput.addPrecondition(new SimplePrecondition(exampleSetInput, new ExampleSetMetaData()));
getTransformer().addRule(new PassThroughRule(exampleSetInput, exampleSetInnerSource, false));
getTransformer().addRule(new SubprocessTransformRule(getSubprocess(0)));
modelInnerSink.addPrecondition(new SimplePrecondition(modelInnerSink, new MetaData(ClusterModel.class)));
getTransformer().addRule(new ExampleSetPassThroughRule(exampleSetInput, exampleSetOutput, SetRelation.EQUAL) {
@Override
public ExampleSetMetaData modifyExampleSet(ExampleSetMetaData metaData) {
if (addsClusterAttribute()) {
metaData.addAttribute(new AttributeMetaData(Attributes.CLUSTER_NAME, Ontology.NOMINAL, Attributes.CLUSTER_NAME));
}
MetaDataTools.checkAndCreateIds(metaData);
return metaData;
}
});
getTransformer().addRule(new GenerateNewMDRule(modelOutput, new MetaData(HierarchicalClusterModel.class)));
}
示例5: AgglomerativeClustering
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
public AgglomerativeClustering(OperatorDescription description) {
super(description);
exampleSetInput.addPrecondition(new DistanceMeasurePrecondition(exampleSetInput, this));
getTransformer().addRule(new GenerateNewMDRule(modelOutput, new MetaData(HierarchicalClusterModel.class)));
getTransformer().addRule(new ExampleSetPassThroughRule(exampleSetInput, exampleSetOutput, SetRelation.EQUAL) {
@Override
public ExampleSetMetaData modifyExampleSet(ExampleSetMetaData metaData) {
metaData.addAttribute(new AttributeMetaData(Attributes.ID_NAME, Ontology.INTEGER, Attributes.ID_NAME));
return metaData;
}
});
}
示例6: doWork
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
@Override
public void doWork() throws OperatorException {
ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);
int maxLeafSize = getParameterAsInt(PARAMETER_MAX_LEAF_SIZE);
// additional checks
Tools.checkAndCreateIds(exampleSet);
Tools.onlyNonMissingValues(exampleSet, getOperatorClassName(), this, new String[0]);
// recursively descend until leaf_size smaller than max_leaf_size
HierarchicalClusterNode root = new HierarchicalClusterNode("root");
HierarchicalClusterModel model = new HierarchicalClusterModel(root);
int createdLeafs = descend(exampleSet, root, 0, maxLeafSize, getParameterAsInt(PARAMETER_MAX_DEPTH) - 1);
if (getParameterAsBoolean(PARAMETER_CREATE_CLUSTER_LABEL) && exampleSetOutput.isConnected()) {
try {
FlattenClusterModel flattener = OperatorService.createOperator(FlattenClusterModel.class);
flattener.setParameter(FlattenClusterModel.PARAMETER_NUMBER_OF_CLUSTER, createdLeafs + "");
ClusterModel flatModel = flattener.flatten(model, exampleSet);
ClusterModel2ExampleSet applier = OperatorService.createOperator(ClusterModel2ExampleSet.class);
ExampleSet labelledExampleSet = applier.addClusterAttribute(exampleSet, flatModel);
exampleSetOutput.deliver(labelledExampleSet);
modelOutput.deliver(model);
} catch (OperatorCreationException e) {
throw new OperatorException("Could not create FlattenClusterModel Operator: " + e, e);
}
} else {
Attribute clusterAttribute = exampleSet.getAttributes().getCluster();
if (clusterAttribute != null) {
exampleSet.getAttributes().remove(clusterAttribute);
}
exampleSetOutput.deliver(exampleSet);
modelOutput.deliver(model);
}
}
示例7: getVisualizationComponent
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
@Override
public Component getVisualizationComponent(Object renderable, IOContainer ioContainer) {
HierarchicalClusterModel cm = (HierarchicalClusterModel) renderable;
JPanel panel = new JPanel(new BorderLayout());
JPanel innerPanel = new JPanel(new BorderLayout());
innerPanel.add(new DendrogramPlotter(cm));
innerPanel.setBorder(BorderFactory.createMatteBorder(10, 10, 5, 5, Colors.WHITE));
panel.add(innerPanel, BorderLayout.CENTER);
return panel;
}
示例8: createReportable
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
@Override
public Reportable createReportable(Object renderable, IOContainer ioContainer, int width, int height) {
HierarchicalClusterModel cm = (HierarchicalClusterModel) renderable;
DendrogramPlotter plotter = new DendrogramPlotter(cm);
plotter.setSize(width, height);
return plotter;
}
示例9: getGraphCreator
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
@Override
public GraphCreator<String, String> getGraphCreator(Object renderable, IOContainer ioContainer) {
if (renderable instanceof HierarchicalClusterModel) {
return new ClusterModelGraphCreator((HierarchicalClusterModel) renderable);
} else if (renderable instanceof ClusterModel) {
return new ClusterModelGraphCreator((ClusterModel) renderable);
} else {
return null;
}
}
示例10: DendrogramPlotter
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
public DendrogramPlotter(HierarchicalClusterModel hcm) {
super(hcm, "dendogram_view");
this.hcm = hcm;
numObjects = hcm.getRootNode().getNumberOfExamplesInSubtree();
minDistance = Double.POSITIVE_INFINITY;
maxDistance = Double.NEGATIVE_INFINITY;
findMinMaxDistance(hcm.getRootNode());
}
示例11: ClusterTreeVisualization
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
public ClusterTreeVisualization(HierarchicalClusterModel cm) {
DefaultTreeModel model = new DefaultTreeModel(generateTreeModel(cm.getRootNode()));
setModel(model);
addTreeSelectionListener(this);
this.clusterModel = cm;
setBackgroundWhite();
}
示例12: doWork
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
@Override
public void doWork() throws OperatorException {
ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);
int maxLeafSize = getParameterAsInt(PARAMETER_MAX_LEAF_SIZE);
// additional checks
Tools.checkAndCreateIds(exampleSet);
Tools.onlyNonMissingValues(exampleSet, getOperatorClassName(), this, new String[0]);
// recursively descend until leaf_size smaller than max_leaf_size
HierarchicalClusterNode root = new HierarchicalClusterNode("root");
HierarchicalClusterModel model = new HierarchicalClusterModel(root);
int createdLeafs = descend(exampleSet, root, 0, maxLeafSize, getParameterAsInt(PARAMETER_MAX_DEPTH) - 1,
getProgress());
if (getParameterAsBoolean(PARAMETER_CREATE_CLUSTER_LABEL) && exampleSetOutput.isConnected()) {
try {
FlattenClusterModel flattener = OperatorService.createOperator(FlattenClusterModel.class);
flattener.setParameter(FlattenClusterModel.PARAMETER_NUMBER_OF_CLUSTER, createdLeafs + "");
ClusterModel flatModel = flattener.flatten(model, exampleSet);
ClusterModel2ExampleSet applier = OperatorService.createOperator(ClusterModel2ExampleSet.class);
ExampleSet labelledExampleSet = applier.addClusterAttribute(exampleSet, flatModel);
exampleSetOutput.deliver(labelledExampleSet);
modelOutput.deliver(model);
} catch (OperatorCreationException e) {
throw new OperatorException("Could not create FlattenClusterModel Operator: " + e, e);
}
} else {
Attribute clusterAttribute = exampleSet.getAttributes().getCluster();
if (clusterAttribute != null) {
exampleSet.getAttributes().remove(clusterAttribute);
}
exampleSetOutput.deliver(exampleSet);
modelOutput.deliver(model);
}
}
示例13: AgglomerativeClustering
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
public AgglomerativeClustering(OperatorDescription description) {
super(description);
exampleSetInput.addPrecondition(new DistanceMeasurePrecondition(exampleSetInput, this));
getTransformer().addRule(new GenerateNewMDRule(modelOutput, new MetaData(HierarchicalClusterModel.class)));
getTransformer().addRule(new ExampleSetPassThroughRule(exampleSetInput, exampleSetOutput, SetRelation.EQUAL) {
@Override
public ExampleSetMetaData modifyExampleSet(ExampleSetMetaData metaData) {
metaData.addAttribute(new AttributeMetaData(Attributes.ID_NAME, Ontology.INTEGER, Attributes.ID_NAME));
return metaData;
}
});
}
示例14: doWork
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
@Override
public void doWork() throws OperatorException {
ExampleSet exampleSet = exampleSetInput.getData(ExampleSet.class);
int maxLeafSize = getParameterAsInt(PARAMETER_MAX_LEAF_SIZE);
// additional checks
Tools.checkAndCreateIds(exampleSet);
Tools.onlyNonMissingValues(exampleSet, "AgglomerativeClustering");
// recursively descend until leaf_size smaller than max_leaf_size
HierarchicalClusterNode root = new HierarchicalClusterNode("root");
HierarchicalClusterModel model = new HierarchicalClusterModel(root);
int createdLeafs = descend(exampleSet, root, 0, maxLeafSize, getParameterAsInt(PARAMETER_MAX_DEPTH) - 1);
if (getParameterAsBoolean(PARAMETER_CREATE_CLUSTER_LABEL) && exampleSetOutput.isConnected()) {
try {
FlattenClusterModel flattener = OperatorService.createOperator(FlattenClusterModel.class);
flattener.setParameter(FlattenClusterModel.PARAMETER_NUMBER_OF_CLUSTER, createdLeafs + "");
ClusterModel flatModel = flattener.flatten(model, exampleSet);
ClusterModel2ExampleSet applier = OperatorService.createOperator(ClusterModel2ExampleSet.class);
ExampleSet labelledExampleSet = applier.addClusterAttribute(exampleSet, flatModel);
exampleSetOutput.deliver(labelledExampleSet);
modelOutput.deliver(model);
} catch (OperatorCreationException e) {
throw new OperatorException("Could not create FlattenClusterModel Operator: "+e, e);
}
} else {
Attribute clusterAttribute = exampleSet.getAttributes().getCluster();
if (clusterAttribute != null) {
exampleSet.getAttributes().remove(clusterAttribute);
}
exampleSetOutput.deliver(exampleSet);
modelOutput.deliver(model);
}
}
示例15: getGraphCreator
import com.rapidminer.operator.clustering.HierarchicalClusterModel; //导入依赖的package包/类
@Override
public GraphCreator<String, String> getGraphCreator(Object renderable, IOContainer ioContainer) {
if (renderable instanceof HierarchicalClusterModel) {
return new ClusterModelGraphCreator((HierarchicalClusterModel)renderable);
} else if (renderable instanceof ClusterModel) {
return new ClusterModelGraphCreator((ClusterModel)renderable);
} else {
return null;
}
}