Class TrainTestSets

  • All Implemented Interfaces:
    OptionHandler

    public class TrainTestSets
    extends java.lang.Object
    implements OptionHandler
    Implements a class for storing training and testing sets for machine-learning methods.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected DataSet test
      the testing examples
      protected DataSet train
      the training examples
    • Constructor Summary

      Constructors 
      Constructor Description
      TrainTestSets()
      Default constructor.
      TrainTestSets​(DataSet train, DataSet test)
      Explicit constructor that sets the training and testing sets to the specified data sets.
      TrainTestSets​(java.lang.String[] options)
      Explicit constructor that processes the specified arguments.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      DataSet getTestingSet()
      Returns the testing set of this train/test set.
      DataSet getTrainingSet()
      Returns the training set of this train/test set.
      void setOptions​(java.lang.String[] options)
      Sets the options for this train/test set.
      void setTestingSet​(DataSet test)
      Sets the testing set of this train/test set to the specified data set.
      void setTrainingSet​(DataSet train)
      Sets the training set of this train/test set to the specified data set.
      java.lang.String toString()
      Returns a string representation of this train/test set in a format similar to that of the file format.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • train

        protected DataSet train
        the training examples
      • test

        protected DataSet test
        the testing examples
    • Constructor Detail

      • TrainTestSets

        public TrainTestSets()
        Default constructor.
      • TrainTestSets

        public TrainTestSets​(java.lang.String[] options)
                      throws java.lang.Exception
        Explicit constructor that processes the specified arguments.
        Parameters:
        options - the arguments for this train/test set
        Throws:
        java.lang.Exception - if the file is not found or if a parsing exception occurs
      • TrainTestSets

        public TrainTestSets​(DataSet train,
                             DataSet test)
        Explicit constructor that sets the training and testing sets to the specified data sets.
        Parameters:
        train - the training set
        test - the testing set
    • Method Detail

      • getTrainingSet

        public DataSet getTrainingSet()
        Returns the training set of this train/test set.
        Returns:
        a training set
      • getTestingSet

        public DataSet getTestingSet()
        Returns the testing set of this train/test set.
        Returns:
        a testing set
      • setTrainingSet

        public void setTrainingSet​(DataSet train)
        Sets the training set of this train/test set to the specified data set.
        Parameters:
        train - the specified training set
      • setTestingSet

        public void setTestingSet​(DataSet test)
        Sets the testing set of this train/test set to the specified data set.
        Parameters:
        test - the specified testing set
      • setOptions

        public void setOptions​(java.lang.String[] options)
                        throws java.lang.Exception
        Sets the options for this train/test set. The -t option loads the data set with the specified file name as the training set. The -T option loads the data set with the specified file name as the testing set.
        Specified by:
        setOptions in interface OptionHandler
        Parameters:
        options - the arguments
        Throws:
        java.lang.Exception - if the file is not found or if a parsing exception occurs
      • toString

        public java.lang.String toString()
        Returns a string representation of this train/test set in a format similar to that of the file format. Includes the testing examples if present.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string containing the attributes information and examples