public class EntropyTrianglePanel extends PrintablePanel implements TechnicalInformationHandler
PrintablePanel
the possibility to print the panel to various file formats.
The Print dialog is accessible via Ctrl+Alt+Shift+"Left Mouse Click".
public static void main(String[] args) {
JFrame frame = new JFrame();
EntropyTrianglePanel et = new EntropyTrianglePanel();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(et);
frame.setVisible(true);
frame.pack();
try {
DataSource source = new DataSource("./datasets/segment-challenge.arff");
Instances train = source.getDataSet();
Instances test = DataSource.read("./datasets/segment-test.arff");
train.setClassIndex(train.numAttributes() - 1);
test.setClassIndex(test.numAttributes() - 1);
weka.classifiers.rules.ZeroR zr = new weka.classifiers.rules.ZeroR();
zr.buildClassifier(train);
Evaluation eval = new Evaluation(train);
eval.evaluateModel(zr, test);
et.addData(eval, zr, test.relationName(), null);
} catch (Exception e) {
System.out.println("Error on main");
e.printStackTrace();
}
}
JComponent.AccessibleJComponent
Component.BaselineResizeBehavior
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
EntropyTrianglePanel()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addData(Evaluation ev,
AbstractClassifier classifier,
String str_dataset,
String str_time)
Adds to the Entropy Triangle the data of a classifier evaluation process.
|
int |
addInstancesFromFile(Instances instances)
Adds a set of instances to the data list of the plot,
checks the compatibility of the instances with the
checkInstance(Instance) method of the
Instances class. |
void |
clearData()
Removes all data and resets the panel.
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed
information about the technical background of this class, e.g., paper
reference or book this class is based on.
|
boolean |
isSplit()
Checks if the graph is showing the split data.
|
void |
setBaseline(boolean show)
Sets the visibility of the H(Px) lines for the different datasets
present in the graph.
|
void |
setSplit(boolean split)
Sets the graph to show separately the data from input and output of the classifier if true is passed,
or just the information of the joint probability distribution if false.
|
getSaveDialogTitle, getWriter, getWriters, getXScale, getYScale, saveComponent, setSaveDialogTitle, setScale
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public int addInstancesFromFile(Instances instances)
checkInstance(Instance)
method of the
Instances
class.
Initialize the data list if necessary.instances
- the set of instances to addInstances.checkInstance(Instance)
public void addData(Evaluation ev, AbstractClassifier classifier, String str_dataset, String str_time) throws Exception
ev
- performed evaluation on the classifier
for the relation named str_dataser
classifier
- the evaluated classifierstr_dataset
- the name of the evaluated relationstr_time
- a string for the time attribute. If null
,
a string with the current timestamp will be generated.Exception
- on errors calculating metrics from the Evaluation
objectpublic void clearData()
public boolean isSplit()
public void setSplit(boolean split)
split
- the new split statepublic void setBaseline(boolean show)
show
- wether to show or not the linespublic TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler