Class CNTKLoader

  • All Implemented Interfaces:
    Serializable, weka.core.converters.BatchConverter, weka.core.converters.FileSourcedConverter, weka.core.converters.Loader, weka.core.EnvironmentHandler, weka.core.OptionHandler, weka.core.RevisionHandler

    public class CNTKLoader
    extends weka.core.converters.AbstractFileLoader
    implements weka.core.converters.BatchConverter, weka.core.OptionHandler
    Reads CNTK data files in text format.

    Valid options are:

     -D <value>
      Whether to print additional debug information to the console.
      (default: off)
     -class-group <value>
      The group representing the class attribute.
      (default: )
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface weka.core.converters.Loader

        weka.core.converters.Loader.StructureNotReadyException
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected String m_ClassGroup
      the group that represents the class attribute.
      protected weka.core.Instances m_Data
      the actual data.
      protected boolean m_Debug
      whether to print some debug information
      protected File m_sourceFile
      Holds the source of the data set.
      protected weka.core.Instances m_structure
      Holds the determined structure (header) of the data set.
      • Fields inherited from class weka.core.converters.AbstractFileLoader

        FILE_EXTENSION_COMPRESSED, m_env, m_File, m_useRelativePath
      • Fields inherited from class weka.core.converters.AbstractLoader

        m_retrieval
      • Fields inherited from interface weka.core.converters.Loader

        BATCH, INCREMENTAL, NONE
    • Constructor Summary

      Constructors 
      Constructor Description
      CNTKLoader()  
    • Field Detail

      • m_structure

        protected weka.core.Instances m_structure
        Holds the determined structure (header) of the data set.
      • m_Data

        protected weka.core.Instances m_Data
        the actual data.
      • m_sourceFile

        protected File m_sourceFile
        Holds the source of the data set.
      • m_Debug

        protected boolean m_Debug
        whether to print some debug information
      • m_ClassGroup

        protected String m_ClassGroup
        the group that represents the class attribute.
    • Constructor Detail

      • CNTKLoader

        public CNTKLoader()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string suitable for the GUI.
        Returns:
        the string
      • listOptions

        public Enumeration listOptions()
        Lists the available options
        Specified by:
        listOptions in interface weka.core.OptionHandler
        Returns:
        an enumeration of the available options
      • setOptions

        public void setOptions​(String[] options)
                        throws Exception
        Parses a given list of options.
        Specified by:
        setOptions in interface weka.core.OptionHandler
        Parameters:
        options - the options
        Throws:
        Exception - if options cannot be set
      • getOptions

        public String[] getOptions()
        Gets the setting
        Specified by:
        getOptions in interface weka.core.OptionHandler
        Returns:
        the current setting
      • setDebug

        public void setDebug​(boolean value)
        Sets whether to print some debug information.
        Parameters:
        value - if true additional debug information will be printed.
      • getDebug

        public boolean getDebug()
        Gets whether additional debug information is printed.
        Returns:
        true if additional debug information is printed
      • debugTipText

        public String debugTipText()
        the tip text for this property
        Returns:
        the tip text
      • getDefaultClassGroup

        public String getDefaultClassGroup()
        Returns the default name of the group representing the class attribute.
        Returns:
        the default
      • setClassGroup

        public void setClassGroup​(String value)
        Sets the name of the group representing the class attribute.
        Parameters:
        value - the name
      • getClassGroup

        public String getClassGroup()
        Returns the name of the group representing the class attribute.
        Returns:
        the name
      • classGroupTipText

        public String classGroupTipText()
        the tip text for this property
        Returns:
        the tip text
      • getFileExtension

        public String getFileExtension()
        Get the file extension used for this type of file
        Specified by:
        getFileExtension in interface weka.core.converters.FileSourcedConverter
        Returns:
        the file extension
      • getFileExtensions

        public String[] getFileExtensions()
        Gets all the file extensions used for this type of file
        Specified by:
        getFileExtensions in interface weka.core.converters.FileSourcedConverter
        Returns:
        the file extensions
      • getFileDescription

        public String getFileDescription()
        Get a one line description of the type of file
        Specified by:
        getFileDescription in interface weka.core.converters.FileSourcedConverter
        Returns:
        a description of the file type
      • reset

        public void reset()
                   throws IOException
        Resets the loader ready to read a new data set
        Specified by:
        reset in interface weka.core.converters.Loader
        Overrides:
        reset in class weka.core.converters.AbstractFileLoader
        Throws:
        IOException
      • setSource

        public void setSource​(File file)
                       throws IOException
        Resets the Loader object and sets the source of the data set to be the supplied File object.
        Specified by:
        setSource in interface weka.core.converters.Loader
        Overrides:
        setSource in class weka.core.converters.AbstractFileLoader
        Parameters:
        file - the source file.
        Throws:
        IOException - if an error occurs
      • getStructure

        public weka.core.Instances getStructure()
                                         throws IOException
        Determines and returns (if possible) the structure (internally the header) of the data set as an empty set of instances.
        Specified by:
        getStructure in interface weka.core.converters.Loader
        Specified by:
        getStructure in class weka.core.converters.AbstractLoader
        Returns:
        the structure of the data set as an empty set of Instances
        Throws:
        IOException - if an error occurs
      • getDataSet

        public weka.core.Instances getDataSet()
                                       throws IOException
        Return the full data set. If the structure hasn't yet been determined by a call to getStructure then method should do so before processing the rest of the data set.
        Specified by:
        getDataSet in interface weka.core.converters.Loader
        Specified by:
        getDataSet in class weka.core.converters.AbstractLoader
        Returns:
        the structure of the data set as an empty set of Instances
        Throws:
        IOException - if there is no source or parsing fails
      • getNextInstance

        public weka.core.Instance getNextInstance​(weka.core.Instances structure)
                                           throws IOException
        CNTKLoader is unable to process a data set incrementally.
        Specified by:
        getNextInstance in interface weka.core.converters.Loader
        Specified by:
        getNextInstance in class weka.core.converters.AbstractLoader
        Parameters:
        structure - ignored
        Returns:
        never returns without throwing an exception
        Throws:
        IOException - always. AdamsCsvLoader is unable to process a data set incrementally.
      • getRevision

        public String getRevision()
        Returns the revision string.
        Specified by:
        getRevision in interface weka.core.RevisionHandler
        Returns:
        the revision
      • main

        public static void main​(String[] args)
        Main method.
        Parameters:
        args - should contain the name of an input file.