📄 predictionassessmentoperatorproperty.java
字号:
datasetsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
datasetsTable.getTableHeader().setReorderingAllowed(false);
TableColumn column = datasetsTable.getColumnModel().getColumn(1);
column.setMinWidth(checkColumnSize);
column.setMaxWidth(checkColumnSize);
column.setPreferredWidth(checkColumnSize);
datasetsTable.setLayout(new BoxLayout(datasetsTable, BoxLayout.Y_AXIS));
}
private void createConfusionMatricesPanel() {
JPanel bigPanel = new JPanel(new GridBagLayout());
GridBagConstraints c1 = new GridBagConstraints();
JPanel confusionMatricesPanel = new JPanel(new BorderLayout());
selectMatrixRadioButton = new JRadioButton();
selectMatrixRadioButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setEnable(false);
}
});
buttonGroup.add(selectMatrixRadioButton);
selectMatrixRadioButton.setActionCommand(PredictionAssessmentOperatorUtil.EVALUATION_CONFUSIONMATRIX_MODE);
selectMatrixRadioButton.setSelected(false);
createThresholdPanel();
thresholdSlider.setEnabled(false);
confusionMatricesPanel.add(thresholdPanel, BorderLayout.CENTER);
c1.ipadx = 0;
c1.ipady = 0;
c1.gridx = 1;
c1.gridy = 0;
c1.weightx = 0.0;
c1.weighty = 0.0;
c1.insets = new Insets(0, 0, 0, 0);
c1.fill = GridBagConstraints.BOTH;
c1.anchor = GridBagConstraints.SOUTHWEST;
bigPanel.add(new JLabel(Resource.srcStr("ConfusionLabel")), c1);
c1.gridx = 0;
c1.gridy = 0;
c1.weightx = 0.0;
c1.weighty = 0.0;
c1.insets = new Insets(0, 0, 0, 2);
c1.fill = GridBagConstraints.BOTH;
c1.anchor = GridBagConstraints.SOUTHEAST;
bigPanel.add(selectMatrixRadioButton, c1);
c1.gridx = 1;
c1.gridy = 1;
c1.weightx = 1.0;
c1.weighty = 1.0;
c1.insets = new Insets(2, 0, 0, 0);
c1.fill = GridBagConstraints.BOTH;
c1.anchor = GridBagConstraints.NORTHWEST;
bigPanel.add(confusionMatricesPanel, c1);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.gridx = 1;
c.gridy = 0;
c.weightx = 0.05;
c.weighty = 0.0;
c.anchor = GridBagConstraints.WEST;
// c.insets = new Insets(0, 5, 20, 20);
c.insets = new Insets(0, 0, 12, 0);
assessmentPanel.add(bigPanel, c);
}
public void createThresholdPanel() {
createThresholdSlider();
thresholdLabel = new JLabel();
thresholdLabel.setText(Resource.srcStr("thresholdLabel") + "(" + thresholdValue + ")");
thresholdPanel = new JPanel();
thresholdPanel.setLayout(new BoxLayout(thresholdPanel, BoxLayout.LINE_AXIS));
thresholdPanel.add(thresholdLabel);
thresholdPanel.add(Box.createRigidArea(new Dimension(14, 0)));
thresholdPanel.add(new JLabel("0"));
thresholdPanel.add(Box.createRigidArea(new Dimension(3, 0)));
thresholdPanel.add(thresholdSlider);
thresholdPanel.add(Box.createRigidArea(new Dimension(3, 0)));
thresholdPanel.add(new JLabel("1"));
thresholdPanel.setBorder(ETCHED_BORDER_INNER_SPACING_THIN);
}
private void createThresholdSlider() {
thresholdSlider = new JSlider(JSlider.HORIZONTAL, 0, 10, 5);
thresholdSlider.addChangeListener(this);
// Turn on labels at major tick marks
thresholdSlider.setMajorTickSpacing(5);
thresholdSlider.setMinorTickSpacing(1);
thresholdSlider.setPaintTicks(true);
Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
labelTable.put(new Integer(0), new JLabel("0"));
labelTable.put(new Integer(5), new JLabel("0.5"));
labelTable.put(new Integer(10), new JLabel("1"));
thresholdValue = (double) thresholdSlider.getValue() / 10;
thresholdSlider.addChangeListener(this);
thresholdSlider.setEnabled(true);
}
private void createEvaluationPanel() {
JPanel bigPanel = new JPanel(new GridBagLayout());
GridBagConstraints c1 = new GridBagConstraints();
JPanel evaluationPanel = new JPanel(new BorderLayout());
selectEvaRadioButton = new JRadioButton();
selectEvaRadioButton.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
setEnable(true);
}
});
buttonGroup.add(selectEvaRadioButton);
selectEvaRadioButton.setSelected(true);
selectEvaRadioButton.setActionCommand(PredictionAssessmentOperatorUtil.EVALUATION_EVALUATIONCHART_MODE);
JPanel subPanel = createComboBoxPanel();
evaluationPanel.add(subPanel, BorderLayout.CENTER);
c1.ipadx = 0;
c1.ipady = 0;
c1.gridx = 0;
c1.gridy = 0;
c1.weightx = 0.0;
c1.weighty = 0.0;
c1.insets = new Insets(0, 0, 0, 2);
c1.fill = GridBagConstraints.BOTH;
c1.anchor = GridBagConstraints.SOUTHEAST;
bigPanel.add(selectEvaRadioButton, c1);
c1.gridx = 1;
c1.gridy = 0;
c1.weightx = 0.0;
c1.weighty = 0.0;
c1.insets = new Insets(0, 0, 0, 0);
c1.fill = GridBagConstraints.BOTH;
c1.anchor = GridBagConstraints.SOUTHWEST;
JLabel evaluationText = new JLabel(Resource.srcStr("evaluationText"));
bigPanel.add(evaluationText, c1);
c1.gridx = 1;
c1.gridy = 1;
c1.weightx = 1.0;
c1.weighty = 1.0;
c1.insets = new Insets(2, 0, 0, 0);
c1.fill = GridBagConstraints.BOTH;
c1.anchor = GridBagConstraints.NORTHWEST;
bigPanel.add(subPanel, c1);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.gridx = 1;
c.gridy = 1;
c.weightx = 0.05;
c.weighty = 0.0;
c.anchor = GridBagConstraints.WEST;
c.insets = new Insets(0, 0, 2, 0);
assessmentPanel.add(bigPanel, c);
}
private JPanel createComboBoxPanel() {
final JPanel comboBoxPanel = new JPanel();
comboBoxPanel.setLayout(new GridBagLayout());
comboBoxPanel.setBorder(ETCHED_BORDER_INNER_SPACING_THIN);
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.weightx = 1.0;
c.weighty = 1.0;
c.insets = new Insets(0, 0, 0, 12);
c.anchor = GridBagConstraints.LINE_START;
c.fill = GridBagConstraints.BOTH;
JLabel targetEventLevelLabel = new JLabel(Resource.srcStr("targetEventLevelLabel"));
comboBoxPanel.add(targetEventLevelLabel, c);
// <<30/06/2005 Mark Li: Modify for Evauation target value
if (m_TargetValueSet == null)
targetEventLevelComboBox = new JComboBox();
else
targetEventLevelComboBox = new JComboBox(m_TargetValueSet.toArray());
targetEventLevelComboBox.setBackground(Color.WHITE);
if (m_TargetValueSet != null)
targetEventLevelComboBox.setSelectedIndex(0);
// zeroRadioButton = new JRadioButton();
// oneRadioButton = new JRadioButton();
//
// zeroRadioButton.addMouseListener(new MouseAdapter() {
// public void mouseClicked(MouseEvent e) {
// //actions here
// }
// });
// levelButtonGroup.add(zeroRadioButton);
// zeroRadioButton.setText("1st");
// zeroRadioButton.setActionCommand(PredictionAssessmentOperatorUtil.EVAUATION_TARGET_ZERO);
//
c.gridx = 1;
c.gridy = 0;
c.weightx = 1.0;
c.weighty = 1.0;
c.gridwidth = 2;
c.insets = new Insets(0, 0, 0, 0);
c.anchor = GridBagConstraints.LINE_START;
c.fill = GridBagConstraints.HORIZONTAL;
//
// c.gridx = 1;
// c.gridy = 0;
// c.weighty = 1.0;
// c.anchor = GridBagConstraints.LINE_START;
// c.insets = new Insets(0, 10, 0, 0);
comboBoxPanel.add(targetEventLevelComboBox, c);
// comboBoxPanel.add(zeroRadioButton, c);
//
// oneRadioButton.addMouseListener(new MouseAdapter() {
// public void mouseCLicked(MouseEvent e) {
// //actions here
// }
// });
// levelButtonGroup.add(oneRadioButton);
// oneRadioButton.setText("2nd");
// oneRadioButton.setActionCommand(PredictionAssessmentOperatorUtil.EVAUATION_TARGET_ONE);
// oneRadioButton.setSelected(true);
// c.gridx = 2;
// c.gridy = 0;
// c.weighty = 1.0;
// c.anchor = GridBagConstraints.LINE_START;
// c.insets = new Insets(0, 0, 0, 0);
// comboBoxPanel.add(oneRadioButton, c);
// 30/06/2005 Mark Li: Modify for Evauation target value>>
c.gridx = 0;
c.gridy = 1;
c.weightx = 1.0;
c.weighty = 1.0;
c.insets = new Insets(0, 0, 0, 0);
c.anchor = GridBagConstraints.LINE_START;
JLabel chartTypeLabel = new JLabel(Resource.srcStr("chartTypeLabel"));
comboBoxPanel.add(chartTypeLabel, c);
c.gridx = 1;
c.gridy = 1;
c.weightx = 1.0;
c.weighty = 1.0;
c.gridwidth = 2;
c.insets = new Insets(0, 0, 0, 0);
c.anchor = GridBagConstraints.LINE_START;
c.fill = GridBagConstraints.HORIZONTAL;
// String[] chartTypes = { "Cumulative Gain Chart", "Lift Chart",
// "ROC Chart" };
// Only two types of evaluation chart are supported in the training
// version of KnowBiz platform.
String[] chartTypes = { PredictionAssessmentOperatorProperty.CHART_TYPE_CUMULATIVE_GAIN,
PredictionAssessmentOperatorProperty.CHART_TYPE_LIFT };
chartTypeComboBox = new JComboBox(chartTypes);
chartTypeComboBox.setBackground(Color.WHITE);
chartTypeComboBox.setSelectedIndex(0);
comboBoxPanel.add(chartTypeComboBox, c);
c.gridx = 0;
c.gridy = 2;
c.weightx = 1.0;
c.gridwidth = 1;
c.weighty = 1.0;
c.insets = new Insets(0, 0, 0, 0);
c.anchor = GridBagConstraints.LINE_START;
JLabel drawStyleLabel = new JLabel(Resource.srcStr("drawStyleLabel"));
comboBoxPanel.add(drawStyleLabel, c);
c.gridx = 1;
c.gridy = 2;
c.weightx = 1.0;
c.weighty = 1.0;
c.gridwidth = 2;
c.insets = new Insets(0, 0, 0, 0);
c.anchor = GridBagConstraints.LINE_START;
c.fill = GridBagConstraints.HORIZONTAL;
String[] drawStyles = { PredictionAssessmentOperatorProperty.DRAW_STYLE_POINT,
PredictionAssessmentOperatorProperty.DRAW_STYLE_LINE };
drawStyleComboBox = new JComboBox(drawStyles);
drawStyleComboBox.setBackground(Color.WHITE);
drawStyleComboBox.setSelectedIndex(0);
comboBoxPanel.add(drawStyleComboBox, c);
return comboBoxPanel;
}
private void createButtonsPanel() {
buttonsPanel = new JPanel();
buttonApply = new JButton(Resource.srcStr("m_ButtonApply"));
buttonReset = new JButton(Resource.srcStr("m_ButtonReset"));
buttonClose = new JButton(Resource.srcStr("m_ButtonClose"));
buttonApply.addActionListener(this);
buttonReset.addActionListener(this);
buttonClose.addActionListener(this);
buttonsPanel.add(buttonApply);
buttonsPanel.add(buttonReset);
buttonsPanel.add(buttonClose);
}
/**
* @see java.awt.event.ActionListener#actionPerformed(ActionEvent)
*/
public void actionPerformed(ActionEvent e) {
if (e.getSource() == buttonApply) {
if (setContent()) {
m_ParameterChanged = true;
}
clearOperatorTempResult();
} else if (e.getSource() == buttonReset) {
// resetContent();
restorePreviousContent();
} else if (e.getSource() == buttonClose) {
close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -