⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 artoolbox.java

📁 数据挖掘中
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*----------------------------------------------------------------------  File    : ARToolbox.java  Contents: association rule induction toolbox  Author  : Christian Borgelt  History : 29.09.2004 file created from file DTToolbox.java----------------------------------------------------------------------*/package arview;import java.io.*;import java.awt.*;import java.awt.event.*;import javax.swing.*;/*--------------------------------------------------------------------*/public class ARToolbox extends JFrame implements Runnable {/*--------------------------------------------------------------------*/  private static final String[] emnames = {    "none",    "abs. confidence difference to prior",    "abs. diff. of confidence quotient to 1",    "abs. diff. of improvement value to 1",    "information difference to prior",    "normalized chi^2 measure" };  private static final String[] sortnames = {    "no sorting",    "ascending w.r.t. frequency",    "descending w.r.t. frequency",    "ascending w.r.t. transaction size sum",    "descending w.r.t. transaction size sum" };  private static final Font font  = new Font("Dialog", Font.BOLD,  12);  private static final Font small = new Font("Dialog", Font.PLAIN, 10);  /* --- format --- */  private final JTextField   recseps;  private final JTextField   fldseps;  private final JTextField   blanks;  private final JTextField   comment;  /* --- files --- */  private final JTextField   f_tra;  private final JTextField   f_rul;  private final JTextField   f_app;  /* --- filters --- */  private final JTextField   mincnt;  private final JTextField   maxcnt;  private final JTextField   minsupp;  private final JTextField   maxsupp;  private final JCheckBox    orig;  private final JTextField   minconf;  private final JComboBox    arem;  private final JTextField   minarem;  /* --- options --- */  private final JComboBox    sort;  private final JCheckBox    prefix;  private final JCheckBox    quick;  private final JCheckBox    memory;  private final JCheckBox    load;  private final JTextField   outfmt;  /* --- status line --- */  private final JTabbedPane  tab;  private final JButton      exec;  private final JTextField   stat;  /* --- other variables --- */  private JFileChooser     chooser = null;  private volatile Process process = null;  private volatile boolean running = false;  private volatile boolean stopped = true;  private String path = null;  /*------------------------------------------------------------------*/  private JFileChooser createChooser ()  {                             /* --- create a file chooser */    JFileChooser fc = new JFileChooser();    fc.setFileSelectionMode(JFileChooser.FILES_ONLY);    fc.setCurrentDirectory(new File("."));    fc.setFileHidingEnabled(true);    fc.setAcceptAllFileFilterUsed(true);    fc.setMultiSelectionEnabled(false);    fc.setFileView(null);       /* create a standard file chooser */    return fc;                  /* without customized filters */  }  /* createChooser() */  /*------------------------------------------------------------------*/  public ARToolbox (Component owner, boolean isProg)  {                             /* --- create toolbox dialog */    GridBagLayout      g    = new GridBagLayout();    GridBagConstraints lc   = new GridBagConstraints();    GridBagConstraints rc   = new GridBagConstraints();    JPanel             grid;    JPanel             bbar;    JLabel             lbl;    JTextArea          help;    JButton            btn;    tab = new JTabbedPane(JTabbedPane.TOP,                          JTabbedPane.SCROLL_TAB_LAYOUT);    lc.fill      =              /* fill fields in both directions */    rc.fill      = GridBagConstraints.HORIZONTAL;    rc.weightx   = 1.0;         /* resize only the input fields, */    lc.weightx   = 0.0;         /* but not the labels */    lc.ipadx     = 10;          /* gap between labels and inputs */    lc.ipady     = 10;          /* make all lines of the same height */    rc.gridwidth = GridBagConstraints.REMAINDER;    /* --- files --- */    grid = new JPanel(g);    grid.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));    tab.addTab("Files", null, grid, null);    lbl   = new JLabel("Transactions file:");    g.setConstraints(lbl,   lc); grid.add(lbl);    btn   = new JButton("Browse...");    g.setConstraints(btn,   rc); grid.add(btn);    f_tra = new JTextField("noname.tra");    g.setConstraints(f_tra, rc); grid.add(f_tra);    btn.addActionListener(new AbstractAction () {      public void actionPerformed (ActionEvent e) {        if (chooser == null) chooser = createChooser();        chooser.setDialogType(JFileChooser.OPEN_DIALOG);        int r = chooser.showDialog(ARToolbox.this, null);        if (r == JFileChooser.APPROVE_OPTION)          f_tra.setText(chooser.getSelectedFile().getPath());      } } );    lbl   = new JLabel("Association rules file:");    g.setConstraints(lbl,   lc); grid.add(lbl);    btn   = new JButton("Browse...");    g.setConstraints(btn,   rc); grid.add(btn);    f_rul = new JTextField("noname.rul");    g.setConstraints(f_rul, rc); grid.add(f_rul);    btn.addActionListener(new AbstractAction () {      public void actionPerformed (ActionEvent e) {        if (chooser == null) chooser = createChooser();        chooser.setDialogType(JFileChooser.OPEN_DIALOG);        int r = chooser.showDialog(ARToolbox.this, null);        if (r == JFileChooser.APPROVE_OPTION)          f_rul.setText(chooser.getSelectedFile().getPath());      } } );    lbl   = new JLabel("Item appearances file:");    g.setConstraints(lbl,   lc); grid.add(lbl);    btn   = new JButton("Browse...");    g.setConstraints(btn,   rc); grid.add(btn);    f_app = new JTextField("");    g.setConstraints(f_app, rc); grid.add(f_app);    btn.addActionListener(new AbstractAction () {      public void actionPerformed (ActionEvent e) {        if (chooser == null) chooser = createChooser();        chooser.setDialogType(JFileChooser.OPEN_DIALOG);        int r = chooser.showDialog(ARToolbox.this, null);        if (r == JFileChooser.APPROVE_OPTION)          f_app.setText(chooser.getSelectedFile().getPath());      } } );    help = new JTextArea(       "The item appearances file is optional.\n"      +"It states in which parts of an association rule\n"      +"an item is allowed to appear.");    help.setFont(small);    help.setBackground(this.getBackground());    g.setConstraints(help, rc); grid.add(help);    help = new JTextArea((String)null);    help.setFont(small);    help.setBackground(this.getBackground());    rc.weighty = 1.0;    g.setConstraints(help, rc); grid.add(help);    rc.weighty = 0.0;    btn = new JButton("Locate Program...");    g.setConstraints(btn, rc); grid.add(btn);    btn.addActionListener(new AbstractAction () {      public void actionPerformed (ActionEvent e) {        if (chooser == null) chooser = createChooser();        chooser.setDialogType(JFileChooser.OPEN_DIALOG);        chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);        int r = chooser.showDialog(ARToolbox.this, null);        if (r == JFileChooser.APPROVE_OPTION)          path = chooser.getSelectedFile().getPath();        chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);      } } );    /* --- filters --- */    grid = new JPanel(g);    grid.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));    tab.addTab("Filters", null, grid, null);    lbl = new JLabel("Minimal number of items:");    g.setConstraints(lbl, lc);       grid.add(lbl);    mincnt = new JTextField("1");    mincnt.setFont(font);    g.setConstraints(mincnt, rc);    grid.add(mincnt);    lbl = new JLabel("Maximal number of items:");    g.setConstraints(lbl, lc);       grid.add(lbl);    maxcnt = new JTextField("5");    maxcnt.setFont(font);    g.setConstraints(maxcnt, rc);    grid.add(maxcnt);    lbl = new JLabel("Minimal support [%]:");    g.setConstraints(lbl, lc);       grid.add(lbl);    minsupp = new JTextField("10");  minsupp.setFont(font);    g.setConstraints(minsupp, rc);   grid.add(minsupp);    lbl = new JLabel("Maximal support [%]:");    g.setConstraints(lbl, lc);       grid.add(lbl);    maxsupp = new JTextField("100"); maxsupp.setFont(font);    g.setConstraints(maxsupp, rc);   grid.add(maxsupp);    lbl = new JLabel("Original support definition:");    g.setConstraints(lbl, lc);       grid.add(lbl);    orig = new JCheckBox("", false);    g.setConstraints(orig, rc);      grid.add(orig);    lbl = new JLabel("Minimal confidence [%]:");    g.setConstraints(lbl, lc);       grid.add(lbl);    minconf = new JTextField("80");  minconf.setFont(font);    g.setConstraints(minconf, rc);   grid.add(minconf);    lbl = new JLabel("Additional evaluation measure:");    g.setConstraints(lbl, rc);       grid.add(lbl);    arem = new JComboBox(emnames);   arem.setSelectedIndex(0);    g.setConstraints(arem, rc);      grid.add(arem);    lbl = new JLabel("Minimal value [%]:");    g.setConstraints(lbl, lc);       grid.add(lbl);    minarem = new JTextField("10");  minarem.setFont(font);    g.setConstraints(minarem, rc);   grid.add(minarem);    help = new JTextArea((String)null);    help.setFont(small); help.setBackground(this.getBackground());    help.setPreferredSize(new Dimension(0,0));    rc.weighty = 1.0;    g.setConstraints(help, rc); grid.add(help);    rc.weighty = 0.0;    /* --- data format --- */    grid = new JPanel(g);    grid.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));    tab.addTab("Format", null, grid, null);    lbl = new JLabel("Record separators:");    g.setConstraints(lbl, lc);         grid.add(lbl);    recseps = new JTextField("\\n");   recseps.setFont(font);    g.setConstraints(recseps, rc);     grid.add(recseps);     lbl = new JLabel("Field separators:");    g.setConstraints(lbl, lc);         grid.add(lbl);    fldseps = new JTextField(" ,\\t"); fldseps.setFont(font);    g.setConstraints(fldseps, rc);     grid.add(fldseps);    lbl = new JLabel("Blank characters:");    g.setConstraints(lbl, lc);         grid.add(lbl);    blanks = new JTextField(" \\r");   blanks.setFont(font);    g.setConstraints(blanks, rc);      grid.add(blanks);    help = new JTextArea(       "Blank characters may fill fields to a specific width;\n"       +"they are discarded when the data file is read.");    help.setFont(small);    help.setBackground(this.getBackground());    g.setConstraints(help, rc); grid.add(help);    lbl = new JLabel("Comment characters:");    g.setConstraints(lbl, lc);         grid.add(lbl);    comment = new JTextField("");      comment.setFont(font);    g.setConstraints(comment, rc);     grid.add(comment);    help = new JTextArea(

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -