/* * The first step of the Apriori algorithm - find all the frequent items with * coverage > MIN_THRESHOLD */ @SuppressWarnings("unchecked") private void findFrequentItems() { Iterator<MemoryEpisode> it = _episodicMemory.GetAllEpisodes().iterator(); while (it.hasNext()) { MemoryEpisode event = it.next(); ArrayList<ActionDetail> details = event.getDetails(); this.identityItems(details); } ArrayList<ActionDetail> records = _episodicMemory.getDetails(); this.identityItems(records); // discard the non-frequent items from the itemSet for (int j = 0; j < _itemSet.size(); j++) { if (_itemSet.get(j).getCoverage() < MIN_THRESHOLD) { _itemSet.remove(j); j--; } } Collections.sort(_itemSet); for (int j = 0; j < _itemSet.size(); j++) { System.out.println(_itemSet.get(j).toString()); } }
/* * Find frequent item sets */ private void findFrequentItemSets(ArrayList<AttributeItemSet> tempItemSet) { ArrayList<AttributeItemSet> frequentItemSet = new ArrayList<AttributeItemSet>(); // count the occurrences in AM Iterator<MemoryEpisode> it = _episodicMemory.GetAllEpisodes().iterator(); while (it.hasNext()) { MemoryEpisode event = it.next(); ArrayList<ActionDetail> details = event.getDetails(); this.countOccurences(tempItemSet, details); } // count the occurrences in STEM ArrayList<ActionDetail> records = _episodicMemory.getDetails(); this.countOccurences(tempItemSet, records); // if coverage is less than the minimum threshold, delete the item set from the tempItemSet list for (int i = 0; i < tempItemSet.size(); i++) { if (tempItemSet.get(i).getCoverage() < this.MIN_THRESHOLD) { tempItemSet.remove(i); i--; } } // Collections.sort(_itemSet); System.out.println("item sets"); for (int j = 0; j < tempItemSet.size(); j++) { System.out.println(tempItemSet.get(j).toString()); } }
public MemoryEpisodeDisplay(MemoryEpisode episode) { _numberOfDetails = 0; _panel = new JPanel(); _panel.setBorder(BorderFactory.createEtchedBorder()); _panel.setLayout(new BoxLayout(_panel, BoxLayout.Y_AXIS)); _panel.setMaximumSize(new Dimension(750, 250)); _panel.setMinimumSize(new Dimension(750, 250)); Dimension d1 = new Dimension(100, 20); Dimension d2 = new Dimension(100, 100); Dimension d3 = new Dimension(115, 80); JPanel pnl = new JPanel(); pnl.setLayout(new BoxLayout(pnl, BoxLayout.X_AXIS)); pnl.setMaximumSize(new Dimension(750, 100)); // ABSTRACT /*JPanel aux = new JPanel(); aux.setLayout(new BoxLayout(aux,BoxLayout.Y_AXIS)); aux.setMaximumSize(d2); aux.setMinimumSize(d2); aux.setBorder(BorderFactory.createLineBorder(new Color(0,0,0))); JLabel lbl = new JLabel("Abstract"); lbl.setMaximumSize(d1); lbl.setMinimumSize(d1); aux.add(lbl);*/ // _abstract = new JTextArea(episode.getAbstract()); /*_abstract = new JTextArea(""); _abstract.setLineWrap(true); _abstract.setMaximumSize(d3); _abstract.setMinimumSize(d3); aux.add(_abstract); pnl.add(aux);*/ // TIME JPanel aux = new JPanel(); aux.setLayout(new BoxLayout(aux, BoxLayout.Y_AXIS)); aux.setMaximumSize(d2); aux.setMinimumSize(d2); aux.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); JLabel lbl = new JLabel("Time"); lbl.setMaximumSize(d1); lbl.setMinimumSize(d1); aux.add(lbl); _time = new JTextArea(episode.getTime().toString()); _time.setLineWrap(true); _time.setMaximumSize(d3); _time.setMinimumSize(d3); aux.add(_time); pnl.add(aux); // PEOPLE aux = new JPanel(); aux.setLayout(new BoxLayout(aux, BoxLayout.Y_AXIS)); aux.setMaximumSize(d2); aux.setMinimumSize(d2); aux.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl = new JLabel("People"); lbl.setMaximumSize(d1); lbl.setMinimumSize(d1); aux.add(lbl); _people = new JTextArea(episode.getPeople().toString()); _people.setLineWrap(true); _people.setMaximumSize(d3); _people.setMinimumSize(d3); aux.add(_people); pnl.add(aux); // LOCATION aux = new JPanel(); aux.setLayout(new BoxLayout(aux, BoxLayout.Y_AXIS)); aux.setMaximumSize(d2); aux.setMinimumSize(d2); aux.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl = new JLabel("Location"); lbl.setMaximumSize(d1); lbl.setMinimumSize(d1); aux.add(lbl); _location = new JTextArea(episode.getLocation().toString()); _location.setLineWrap(true); _location.setMaximumSize(d3); _location.setMinimumSize(d3); aux.add(_location); pnl.add(aux); // OBJECTS aux = new JPanel(); aux.setLayout(new BoxLayout(aux, BoxLayout.Y_AXIS)); aux.setMaximumSize(d2); aux.setMinimumSize(d2); aux.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl = new JLabel("Objects"); lbl.setMaximumSize(d1); lbl.setMinimumSize(d1); aux.add(lbl); _objects = new JTextArea(episode.getObjects().toString()); _objects.setLineWrap(true); _objects.setMaximumSize(d3); _objects.setMinimumSize(d3); aux.add(_objects); pnl.add(aux); _panel.add(pnl); // DETAILS _details = new JPanel(); _details.setBorder(BorderFactory.createTitledBorder("Details")); _details.setLayout(new BoxLayout(_details, BoxLayout.Y_AXIS)); aux = new JPanel(); aux.setLayout(new BoxLayout(aux, BoxLayout.X_AXIS)); aux.setMinimumSize(new Dimension(750, 30)); aux.setMaximumSize(new Dimension(750, 30)); lbl = new JLabel("ID"); lbl.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl.setMinimumSize(new Dimension(30, 30)); lbl.setMaximumSize(new Dimension(30, 30)); aux.add(lbl); /*lbl = new JLabel("Ca."); lbl.setBorder(BorderFactory.createLineBorder(new Color(0,0,0))); lbl.setMinimumSize(new Dimension(30,30)); lbl.setMaximumSize(new Dimension(30,30)); aux.add(lbl); lbl = new JLabel("Eff."); lbl.setBorder(BorderFactory.createLineBorder(new Color(0,0,0))); lbl.setMinimumSize(new Dimension(30,30)); lbl.setMaximumSize(new Dimension(30,30)); aux.add(lbl);*/ lbl = new JLabel("Subject"); // Who? lbl.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl.setMinimumSize(new Dimension(50, 30)); lbl.setMaximumSize(new Dimension(50, 30)); aux.add(lbl); lbl = new JLabel("Action"); // What? lbl.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl.setMinimumSize(new Dimension(80, 30)); lbl.setMaximumSize(new Dimension(80, 30)); aux.add(lbl); lbl = new JLabel("Intention"); // Goal? lbl.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl.setMinimumSize(new Dimension(80, 30)); lbl.setMaximumSize(new Dimension(80, 30)); aux.add(lbl); lbl = new JLabel("Target"); // Whom? lbl.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl.setMinimumSize(new Dimension(80, 30)); lbl.setMaximumSize(new Dimension(80, 30)); aux.add(lbl); lbl = new JLabel("Status"); // Activation, Success, Failure? lbl.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl.setMinimumSize(new Dimension(80, 30)); lbl.setMaximumSize(new Dimension(80, 30)); aux.add(lbl); lbl = new JLabel("Meaning"); // Which speechAct? lbl.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl.setMinimumSize(new Dimension(80, 30)); lbl.setMaximumSize(new Dimension(80, 30)); aux.add(lbl); lbl = new JLabel("Path"); // Multimedia directory lbl.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl.setMinimumSize(new Dimension(80, 30)); lbl.setMaximumSize(new Dimension(80, 30)); aux.add(lbl); lbl = new JLabel("Object"); // object/third person lbl.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl.setMinimumSize(new Dimension(80, 30)); lbl.setMaximumSize(new Dimension(80, 30)); aux.add(lbl); lbl = new JLabel("Desirability"); // Desirable? lbl.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl.setMinimumSize(new Dimension(80, 30)); lbl.setMaximumSize(new Dimension(80, 30)); aux.add(lbl); lbl = new JLabel("Praiseworthiness"); // Praiseworthy? lbl.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl.setMinimumSize(new Dimension(80, 30)); lbl.setMaximumSize(new Dimension(80, 30)); aux.add(lbl); /*lbl = new JLabel("Parameters"); // How? lbl.setBorder(BorderFactory.createLineBorder(new Color(0,0,0))); lbl.setMinimumSize(new Dimension(100,30)); lbl.setMaximumSize(new Dimension(100,30)); aux.add(lbl);*/ lbl = new JLabel("Feeling"); lbl.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl.setMinimumSize(new Dimension(100, 30)); lbl.setMaximumSize(new Dimension(100, 30)); aux.add(lbl); lbl = new JLabel("Location"); lbl.setBorder(BorderFactory.createLineBorder(new Color(0, 0, 0))); lbl.setMinimumSize(new Dimension(100, 30)); lbl.setMaximumSize(new Dimension(100, 30)); aux.add(lbl); _details.add(aux); JPanel prop = new JPanel(); prop.setLayout(new BoxLayout(prop, BoxLayout.Y_AXIS)); prop.setMaximumSize(new Dimension(750, 150)); prop.setMinimumSize(new Dimension(750, 150)); JScrollPane propertiesScroll = new JScrollPane(prop); ListIterator<ActionDetail> li = episode.getDetails().listIterator(); while (li.hasNext()) { prop.add(new MemoryDetailPanel((ActionDetail) li.next())); _numberOfDetails++; } _details.add(propertiesScroll); _panel.add(_details); }