Class SimpleJsonCommunicationProcessor

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.SizeOfHandler, Serializable

    public class SimpleJsonCommunicationProcessor
    extends AbstractCommunicationProcessor
    Turns Instances/Instance into simple JSON.
    Train:
     {
       Model: 
       Train: {
         X:
           [...],  // single instance
           ...
         ],
         Y: [...]  // class values
       }
     }
     
    
     Predict (send):
     
     {
       Model: 
       Train: {
         X: [...],  // single instance
       }
     }
     
    
     Predict (receive):
     
     {
       Error: 
       Prediction: [...]  // distribution array (single double for numeric class)
     }
     
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Constructor Detail

      • SimpleJsonCommunicationProcessor

        public SimpleJsonCommunicationProcessor()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • instanceToRow

        protected net.minidev.json.JSONArray instanceToRow​(weka.core.Instance inst)
        Converts a single Instance into a JSON array (excluding class).
        Parameters:
        inst - the instance to convert
        Returns:
        the JSON array