Class Simple

    • Constructor Detail

      • Simple

        public Simple()
    • Method Detail

      • toBytes

        protected byte[] toBytes​(com.google.gson.JsonObject json)
        Turns the JSON object into bytes.
        Parameters:
        json - the object to convert
        Returns:
        the bytes
      • toCSV

        protected String toCSV​(weka.core.Instances data)
        Turns the instances into CSV.
        Parameters:
        data - the instances to convert
        Returns:
        the CSV string
      • toCSV

        protected String toCSV​(weka.core.Instance inst)
        Turns the instance into CSV.
        Parameters:
        inst - the instance to convert
        Returns:
        the CSV string
      • addDatasetInfo

        protected void addDatasetInfo​(com.google.gson.JsonObject json,
                                      weka.core.Instances data)
        Information about the dataset to the JSON object.
        Parameters:
        json - the json object to add to
        data - the dataset structure
      • prepareTrain

        public byte[] prepareTrain​(weka.core.Instances data,
                                   SocketFacade facade)
        Prepares the data for training.
        Specified by:
        prepareTrain in class AbstractDataPreparation
        Parameters:
        data - the data to use
        facade - the classifier using the data preparation
        Returns:
        the prepared data
      • prepareClassify

        public byte[] prepareClassify​(weka.core.Instance inst,
                                      SocketFacade facade)
        Prepares the instance for the Classifier.classifyInstance(Instance) method.
        Specified by:
        prepareClassify in class AbstractDataPreparation
        Parameters:
        inst - the data to use
        facade - the classifier using the data preparation
        Returns:
        the prepared data
      • prepareDistribution

        public byte[] prepareDistribution​(weka.core.Instance inst,
                                          SocketFacade facade)
        Prepares the instance for the Classifier.distributionForInstance(Instance) method.
        Specified by:
        prepareDistribution in class AbstractDataPreparation
        Parameters:
        inst - the data to use
        facade - the classifier using the data preparation
        Returns:
        the prepared data
      • fromBytes

        protected com.google.gson.JsonElement fromBytes​(byte[] data)
        Turns the bytes back into a JSON object.
        Parameters:
        data - the data
        Returns:
        the generate JSON object
      • parseTrain

        public String parseTrain​(byte[] data)
        Parses the data received from the process from the training process.
        Specified by:
        parseTrain in class AbstractDataPreparation
        Parameters:
        data - the data to parse
        Returns:
        null if successful, otherwise error message
      • parseClassify

        public double parseClassify​(byte[] data)
        Parses the data received from the process, to be returned by the Classifier.classifyInstance(Instance) method.
        Specified by:
        parseClassify in class AbstractDataPreparation
        Parameters:
        data - the data to parse
        Returns:
        the classification
      • parseDistribution

        public double[] parseDistribution​(byte[] data,
                                          int numClasses)
        Parses the data received from the process, to be returned by the Classifier.distributionForInstance(Instance) method.
        Specified by:
        parseDistribution in class AbstractDataPreparation
        Parameters:
        data - the data to parse
        numClasses - the number of classes
        Returns:
        the class distribution