Class FusionJsonCommunicationProcessor

  • 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 FusionJsonCommunicationProcessor
    extends AbstractCommunicationProcessor
    Turns Instances/Instance into fusion JSON.
    Train:
     {
       "names": [
           // the model name
       ]
       "inputs": {
         "input1": [
             [...],  // single instance or class value
             ...
           ]
           ...,
         "input2": [
             [...],  // single instance or class value
             ...
           ]
           ...,
         ]
       }
     }
     
    
     Predict (send):
     
     {
       "names": [
           // the model name
       ]
       "inputs": {
         "input1": [
             [...],  // single instance
             ...
           ]
           ...,
         "input2": [
             [...],  // single instance
             ...
           ]
           ...,
         ]
       }
     }
     
    
     Predict (receive):
     
     {
       "error": 
       "outputs": {
         "": {
           "output1": [
             [...],  // single prediction
             ...
           ],
         }
       }
     }
     
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected String m_ClassAttName
      the class attribute name.
      protected Map<adams.core.base.BaseString,​gnu.trove.list.TIntList> m_Mapping
      the mapping between fusion subset names and attribute indices.
      protected adams.core.base.BaseString[] m_Names
      the names for the fusion subsets.
      protected adams.core.base.BaseRegExp[] m_RegExps
      the regular expressions to identify fusion subsets.
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Field Detail

      • m_RegExps

        protected adams.core.base.BaseRegExp[] m_RegExps
        the regular expressions to identify fusion subsets.
      • m_Names

        protected adams.core.base.BaseString[] m_Names
        the names for the fusion subsets.
      • m_Mapping

        protected Map<adams.core.base.BaseString,​gnu.trove.list.TIntList> m_Mapping
        the mapping between fusion subset names and attribute indices.
      • m_ClassAttName

        protected String m_ClassAttName
        the class attribute name.
    • Constructor Detail

      • FusionJsonCommunicationProcessor

        public FusionJsonCommunicationProcessor()
    • 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
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.core.option.AbstractOptionHandler
      • setRegExps

        public void setRegExps​(adams.core.base.BaseRegExp[] value)
        Sets the regular expression to apply to the attribute names for identifying the fusion subsets (incl class).
        Parameters:
        value - the expressions
      • getRegExps

        public adams.core.base.BaseRegExp[] getRegExps()
        Returns the regular expression to apply to the attribute names for identifying the fusion subsets (incl class).
        Returns:
        the expressions
      • regExpsTipText

        public String regExpsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setNames

        public void setNames​(adams.core.base.BaseString[] value)
        Sets the names to use for the fusion subsets (corresponds to the subsets).
        Parameters:
        value - the names
      • getNames

        public adams.core.base.BaseString[] getNames()
        Returns the names to use for the fusion subsets (corresponds to the subsets).
        Returns:
        the names
      • namesTipText

        public String namesTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • instanceToRow

        protected net.minidev.json.JSONArray instanceToRow​(weka.core.Instance inst,
                                                           adams.core.base.BaseString name)
        Converts a single Instance into a JSON array.
        Parameters:
        inst - the instance to convert
        name - the name of the mapping
        Returns:
        the JSON array