本文整理汇总了Java中weka.gui.treevisualizer.TreeVisualizer类的典型用法代码示例。如果您正苦于以下问题:Java TreeVisualizer类的具体用法?Java TreeVisualizer怎么用?Java TreeVisualizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeVisualizer类属于weka.gui.treevisualizer包,在下文中一共展示了TreeVisualizer类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visualizeTree
import weka.gui.treevisualizer.TreeVisualizer; //导入依赖的package包/类
/**
* Pops up a TreeVisualizer for the classifier from the currently selected
* item in the results list.
*
* @param dottyString the description of the tree in dotty format
* @param treeName the title to assign to the display
*/
protected void visualizeTree(String dottyString, String treeName) {
final javax.swing.JFrame jf =
new javax.swing.JFrame("Weka Classifier Tree Visualizer: " + treeName);
jf.setSize(500, 400);
jf.getContentPane().setLayout(new BorderLayout());
TreeVisualizer tv = new TreeVisualizer(null, dottyString, new PlaceNode2());
jf.getContentPane().add(tv, BorderLayout.CENTER);
jf.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
jf.dispose();
}
});
jf.setVisible(true);
tv.fitToScreen();
}
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:25,代码来源:ClassifierPanel.java
示例2: visualizeTree
import weka.gui.treevisualizer.TreeVisualizer; //导入依赖的package包/类
/**
* Pops up a TreeVisualizer for the associator from the currently selected
* item in the results list
*
* @param dottyString the description of the tree in dotty format
* @param treeName the title to assign to the display
*/
protected void visualizeTree(String dottyString, String treeName) {
final javax.swing.JFrame jf = new javax.swing.JFrame(
"Weka Classifier Tree Visualizer: " + treeName);
jf.setSize(500, 400);
jf.getContentPane().setLayout(new BorderLayout());
TreeVisualizer tv = new TreeVisualizer(null, dottyString, new PlaceNode2());
jf.getContentPane().add(tv, BorderLayout.CENTER);
jf.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
jf.dispose();
}
});
jf.setVisible(true);
tv.fitToScreen();
}
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:25,代码来源:AssociationsPanel.java
示例3: visualizeTree
import weka.gui.treevisualizer.TreeVisualizer; //导入依赖的package包/类
/**
* Pops up a TreeVisualizer for the classifier from the currently selected
* item in the results list.
*
* @param dottyString the description of the tree in dotty format
* @param treeName the title to assign to the display
*/
protected void visualizeTree(String dottyString, String treeName) {
final javax.swing.JFrame jf = new javax.swing.JFrame(
"Weka Classifier Tree Visualizer: " + treeName);
jf.setSize(500, 400);
jf.getContentPane().setLayout(new BorderLayout());
TreeVisualizer tv = new TreeVisualizer(null, dottyString, new PlaceNode2());
jf.getContentPane().add(tv, BorderLayout.CENTER);
jf.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
jf.dispose();
}
});
jf.setVisible(true);
tv.fitToScreen();
}
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:25,代码来源:ClassifierPanel.java
示例4: visualizeTree
import weka.gui.treevisualizer.TreeVisualizer; //导入依赖的package包/类
/**
* Pops up a TreeVisualizer for the associator from the currently selected
* item in the results list
*
* @param dottyString the description of the tree in dotty format
* @param treeName the title to assign to the display
*/
protected void visualizeTree(String dottyString, String treeName) {
final javax.swing.JFrame jf = new javax.swing.JFrame(
"Weka Classifier Tree Visualizer: " + treeName);
jf.setSize(500, 400);
jf.getContentPane().setLayout(new BorderLayout());
TreeVisualizer tv = new TreeVisualizer(null, dottyString, new PlaceNode2());
jf.getContentPane().add(tv, BorderLayout.CENTER);
jf.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
jf.dispose();
}
});
jf.setVisible(true);
tv.fitToScreen();
}
开发者ID:dsibournemouth,项目名称:autoweka,代码行数:25,代码来源:AssociationsPanel.java
示例5: visualizeTree
import weka.gui.treevisualizer.TreeVisualizer; //导入依赖的package包/类
/**
* Pops up a TreeVisualizer for the classifier from the currently selected
* item in the results list.
*
* @param dottyString the description of the tree in dotty format
* @param treeName the title to assign to the display
*/
protected void visualizeTree(String dottyString, String treeName) {
final javax.swing.JFrame jf = new javax.swing.JFrame(
"Weka Classifier Tree Visualizer: " + treeName);
jf.setSize(500, 400);
jf.getContentPane().setLayout(new BorderLayout());
TreeVisualizer tv = new TreeVisualizer(null, dottyString, new PlaceNode2());
jf.getContentPane().add(tv, BorderLayout.CENTER);
jf.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
jf.dispose();
}
});
jf.setVisible(true);
tv.fitToScreen();
}
开发者ID:umple,项目名称:umple,代码行数:25,代码来源:ClassifierPanel.java
示例6: visualizeTree
import weka.gui.treevisualizer.TreeVisualizer; //导入依赖的package包/类
/**
* Pops up a TreeVisualizer for the classifier from the currently selected
* item in the results list
*
* @param dottyString the description of the tree in dotty format
* @param treeName the title to assign to the display
*/
protected void visualizeTree(String dottyString, String treeName) {
final javax.swing.JFrame jf = new javax.swing.JFrame(Messages.getInstance()
.getString("ClassifierPanel_VisualizeTree_JF_JFrame_Text") + treeName);
jf.setSize(500, 400);
jf.getContentPane().setLayout(new BorderLayout());
TreeVisualizer tv = new TreeVisualizer(null, dottyString, new PlaceNode2());
jf.getContentPane().add(tv, BorderLayout.CENTER);
jf.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
jf.dispose();
}
});
jf.setVisible(true);
tv.fitToScreen();
}
开发者ID:williamClanton,项目名称:jbossBA,代码行数:25,代码来源:ClassifierPanel.java
示例7: visualize
import weka.gui.treevisualizer.TreeVisualizer; //导入依赖的package包/类
public void visualize() throws Exception{
// display classifier
final javax.swing.JFrame jf =
new javax.swing.JFrame("Weka Classifier Tree Visualizer: J48");
jf.setSize(500,400);
jf.getContentPane().setLayout(new BorderLayout());
TreeVisualizer tv = new TreeVisualizer(null,((J48)tree).graph(),new PlaceNode2());
jf.getContentPane().add(tv, BorderLayout.CENTER);
jf.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
jf.dispose();
}
});
jf.setVisible(true);
tv.fitToScreen();
}
开发者ID:amplia,项目名称:weka-classifier-examples,代码行数:18,代码来源:Classifier.java
示例8: start
import weka.gui.treevisualizer.TreeVisualizer; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
loadData();
tree = new J48();
tree.buildClassifier(data);
noClassificationChart = buildChart("No Classification (click to add new data)", buildSingleSeries());
clusteredChart = buildChart("Clustered", buildClusteredSeries());
realDataChart = buildChart("Real Data (+ Decision Tree classification for new data)", buildLabeledSeries());
noClassificationChart.setOnMouseClicked(e -> {
Axis<Number> xAxis = noClassificationChart.getXAxis();
Axis<Number> yAxis = noClassificationChart.getYAxis();
Point2D mouseSceneCoords = new Point2D(e.getSceneX(), e.getSceneY());
double x = xAxis.sceneToLocal(mouseSceneCoords).getX();
double y = yAxis.sceneToLocal(mouseSceneCoords).getY();
Number xValue = xAxis.getValueForDisplay(x);
Number yValue = yAxis.getValueForDisplay(y);
reloadSeries(xValue, yValue);
});
Label lblDecisionTreeTitle = new Label("Decision Tree generated for the Iris dataset:");
Text txtTree = new Text(tree.toString());
String graph = tree.graph();
SwingNode sw = new SwingNode();
SwingUtilities.invokeLater(() -> {
TreeVisualizer treeVisualizer = new TreeVisualizer(null, graph, new PlaceNode2());
treeVisualizer.setPreferredSize(new Dimension(600, 500));
sw.setContent(treeVisualizer);
});
Button btnRestore = new Button("Restore original data");
Button btnSwapColors = new Button("Swap clustered chart colors");
StackPane spTree = new StackPane(sw);
spTree.setPrefWidth(300);
spTree.setPrefHeight(350);
VBox vbDecisionTree = new VBox(5, lblDecisionTreeTitle, new Separator(), spTree,
new HBox(10, btnRestore, btnSwapColors));
btnRestore.setOnAction(e -> {
loadData();
reloadSeries();
});
btnSwapColors.setOnAction(e -> swapClusteredChartSeriesColors());
lblDecisionTreeTitle.setTextFill(Color.DARKRED);
lblDecisionTreeTitle.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, FontPosture.ITALIC, 16));
txtTree.setTranslateX(100);
txtTree.setFont(Font.font(Font.getDefault().getFamily(), FontWeight.BOLD, FontPosture.ITALIC, 14));
txtTree.setLineSpacing(1);
txtTree.setTextAlignment(TextAlignment.LEFT);
vbDecisionTree.setTranslateY(20);
vbDecisionTree.setTranslateX(20);
GridPane gpRoot = new GridPane();
gpRoot.add(realDataChart, 0, 0);
gpRoot.add(clusteredChart, 1, 0);
gpRoot.add(noClassificationChart, 0, 1);
gpRoot.add(vbDecisionTree, 1, 1);
stage.setScene(new Scene(gpRoot));
stage.setTitle("Íris dataset clustering and visualization");
stage.show();
}
开发者ID:jesuino,项目名称:java-ml-projects,代码行数:63,代码来源:Clustering.java
示例9: userDataEvent
import weka.gui.treevisualizer.TreeVisualizer; //导入依赖的package包/类
/**
* This receives shapes from the data view.
* It then enters these shapes into the decision tree structure.
* @param e Contains the shapes, and other info.
*/
public void userDataEvent(VisualizePanelEvent e) {
if (m_propertyDialog != null) {
m_propertyDialog.dispose();
m_propertyDialog = null;
}
try {
if (m_focus != null) {
double wdom = e.getInstances1().numInstances()
+ e.getInstances2().numInstances();
if (wdom == 0) {
wdom = 1;
}
TreeClass tmp = m_focus;
m_focus.m_set1 = new TreeClass(null, e.getAttribute1(),
e.getAttribute2(), m_nextId,
e.getInstances1().numInstances() / wdom,
e.getInstances1(), m_focus);
m_focus.m_set2 = new TreeClass(null, e.getAttribute1(),
e.getAttribute2(), m_nextId,
e.getInstances2().numInstances() / wdom,
e.getInstances2(), m_focus);
//this needs the other instance
//tree_frame.getContentPane().removeAll();
m_focus.setInfo(e.getAttribute1(), e.getAttribute2(), e.getValues());
//System.out.println(Thread.currentThread().getStackTrace()[1].getClassName() +graph());
m_tView = new TreeVisualizer(this, graph(), new PlaceNode2());
//tree_frame.getContentPane().add(m_tView);
//tree_frame.getContentPane().doLayout();
m_reps.setComponentAt(0, m_tView);
m_focus = m_focus.m_set2;
m_tView.setHighlight(m_focus.m_identity);
m_iView.setInstances(m_focus.m_training);
if (tmp.m_attrib1 >= 0) {
m_iView.setXIndex(tmp.m_attrib1);
}
if (tmp.m_attrib2 >= 0) {
m_iView.setYIndex(tmp.m_attrib2);
}
m_iView.setColourIndex(m_focus.m_training.classIndex());
if (((Double)((FastVector)m_focus.m_ranges.elementAt(0)).
elementAt(0)).intValue() != LEAF) {
m_iView.setShapes(m_focus.m_ranges);
}
//m_iView.setSIndex(2);
}
else {
System.out.println(Thread.currentThread().getStackTrace()[1].getClassName() +"Somehow the focus is null");
}
} catch(Exception er) {
System.out.println(Thread.currentThread().getStackTrace()[1].getClassName() +"Error : " + er);
System.out.println(Thread.currentThread().getStackTrace()[1].getClassName() +"Part of user input so had to catch here");
//er.printStackTrace();
}
}
开发者ID:williamClanton,项目名称:jbossBA,代码行数:70,代码来源:UserClassifier.java
注:本文中的weka.gui.treevisualizer.TreeVisualizer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论