public class SerializedModelSaver extends JPanel implements BeanCommon, Visible, BatchClassifierListener, IncrementalClassifierListener, BatchClustererListener, EnvironmentHandler, Serializable
JComponent.AccessibleJComponentComponent.BaselineResizeBehavior| Modifier and Type | Field and Description |
|---|---|
static int |
BINARY |
static String |
FILE_EXTENSION
the extension for serialized models (binary Java serialization)
|
static int |
KOMLV |
static ArrayList<Tag> |
s_fileFormatsAvailable
Available file formats.
|
static int |
XSTREAM |
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
SerializedModelSaver()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
acceptClassifier(BatchClassifierEvent ce)
Accept and save a batch trained classifier.
|
void |
acceptClassifier(IncrementalClassifierEvent ce)
Accept and save an incrementally trained classifier.
|
void |
acceptClusterer(BatchClustererEvent ce)
Accept and save a batch trained clusterer.
|
boolean |
connectionAllowed(EventSetDescriptor esd)
Returns true if, at this time,
the object will accept a connection according to the supplied
EventSetDescriptor.
|
boolean |
connectionAllowed(String eventName)
Returns true if, at this time,
the object will accept a connection according to the supplied
event name.
|
void |
connectionNotification(String eventName,
Object source)
Notify this object that it has been registered as a listener with
a source with respect to the supplied event name.
|
void |
disconnectionNotification(String eventName,
Object source)
Notify this object that it has been deregistered as a listener with
a source with respect to the supplied event name.
|
String |
getCustomName()
Get the custom (descriptive) name for this bean (if one has been set)
|
File |
getDirectory()
Get the directory that the model(s) will be saved into
|
Tag |
getFileFormat()
Get the file format to use for saving.
|
boolean |
getIncludeRelationName()
Get whether the relation name of the training
data used to create the model is to be included
in the filename of the serialized model.
|
String |
getPrefix()
Get the prefix to prepend to the model file names.
|
boolean |
getUseRelativePath()
Get whether to use relative paths for the directory.
|
BeanVisual |
getVisual()
Get the visual being used by this data source.
|
String |
globalInfo()
Global info for this bean.
|
boolean |
isBusy()
Returns true if.
|
static void |
saveBinary(File saveTo,
Object model,
Instances header)
Save a model in binary form.
|
static void |
saveKOML(File saveTo,
Object model,
Instances header)
Save a model in KOML deep object serialized XML form.
|
static void |
saveXStream(File saveTo,
Object model,
Instances header)
Save a model in XStream deep object serialized XML form.
|
void |
setCustomName(String name)
Set a custom (descriptive) name for this bean
|
void |
setDirectory(File d)
Set the directory that the model(s) will be saved into.
|
void |
setEnvironment(Environment env)
Set environment variables to use.
|
void |
setFileFormat(Tag ff)
Set the file format to use for saving.
|
void |
setIncludeRelationName(boolean rn)
Set whether the relation name of the training data
used to create the model should be included as part
of the filename for the serialized model.
|
void |
setLog(Logger logger)
Set a log for this bean.
|
void |
setPrefix(String p)
Set the prefix to prepend to the model file names.
|
void |
setUseRelativePath(boolean rp)
Set whether to use relative paths for the directory.
|
void |
setVisual(BeanVisual newVisual)
Set the visual for this data source.
|
void |
stop()
Stop any processing that the bean might be doing.
|
void |
useDefaultVisual()
Use the default images for this bean.
|
Tag |
validateFileFormat(Tag ff)
Validate the file format.
|
getAccessibleContext, getUI, getUIClassID, setUI, updateUIaddAncestorListener, 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, 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, updateadd, 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, validateaction, 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, hide, 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, transferFocusUpCyclepublic static final int BINARY
public static final int KOMLV
public static final int XSTREAM
public static final String FILE_EXTENSION
public void setCustomName(String name)
setCustomName in interface BeanCommonname - the name to usepublic String getCustomName()
getCustomName in interface BeanCommonpublic void useDefaultVisual()
useDefaultVisual in interface Visiblepublic void setVisual(BeanVisual newVisual)
public BeanVisual getVisual()
public boolean connectionAllowed(EventSetDescriptor esd)
connectionAllowed in interface BeanCommonesd - the EventSetDescriptorpublic boolean connectionAllowed(String eventName)
connectionAllowed in interface BeanCommoneventName - the eventpublic void connectionNotification(String eventName, Object source)
connectionNotification in interface BeanCommoneventName - the eventsource - the source with which this object has been registered as
a listenerpublic void disconnectionNotification(String eventName, Object source)
disconnectionNotification in interface BeanCommoneventName - the eventsource - the source with which this object has been registered as
a listenerpublic void setLog(Logger logger)
setLog in interface BeanCommonlogger - a weka.gui.Logger valuepublic void stop()
stop in interface BeanCommonpublic boolean isBusy()
isBusy in interface BeanCommonpublic void acceptClusterer(BatchClustererEvent ce)
acceptClusterer in interface BatchClustererListenerce - a BatchClassifierEvent valuepublic void acceptClassifier(IncrementalClassifierEvent ce)
acceptClassifier in interface IncrementalClassifierListenerce - the BatchClassifierEvent containing the classifierpublic void acceptClassifier(BatchClassifierEvent ce)
acceptClassifier in interface BatchClassifierListenerce - the BatchClassifierEvent containing the classifierpublic static void saveBinary(File saveTo, Object model, Instances header) throws IOException
saveTo - the file name to save tomodel - the model to saveheader - the header of the data that was used to train the model (optional)IOExceptionpublic static void saveKOML(File saveTo, Object model, Instances header) throws Exception
saveTo - the file name to save tomodel - the model to saveheader - the header of the data that was used to train the model (optional)Exceptionpublic static void saveXStream(File saveTo, Object model, Instances header) throws Exception
saveTo - the file name to save tomodel - the model to saveheader - the header of the data that was used to train the model (optional)Exceptionpublic File getDirectory()
public void setDirectory(File d)
d - the directory to save topublic void setUseRelativePath(boolean rp)
rp - true if relative paths are to be usedpublic boolean getUseRelativePath()
public void setIncludeRelationName(boolean rn)
rn - true if the relation name should be included
in the file namepublic boolean getIncludeRelationName()
public String getPrefix()
public void setPrefix(String p)
p - the prefix to prependpublic String globalInfo()
public void setFileFormat(Tag ff)
ff - the file format to usepublic Tag getFileFormat()
public Tag validateFileFormat(Tag ff)
ff - the current file format to validatepublic void setEnvironment(Environment env)
setEnvironment in interface EnvironmentHandlerenv - the environment variables to
useCopyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.