Class SimpleMekaService

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

    public class SimpleMekaService
    extends adams.core.option.AbstractOptionHandler
    implements MekaService, OwnedByMekaServiceWS
    Class that implements the meka web service.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_StorageName

        protected adams.flow.control.StorageName m_StorageName
        the name of the lookup table in the internal storage.
    • Constructor Detail

      • SimpleMekaService

        public SimpleMekaService()
        Default Constructor.

        NB: the owning webservice needs to get set before using this implemention, using the setOwner(MekaServiceWS) method.
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string for the GUI that describes this object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        the description
      • 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
      • setStorageName

        public void setStorageName​(adams.flow.control.StorageName value)
        Sets the name for the lookup table in the internal storage.
        Parameters:
        value - the name
      • getStorageName

        public adams.flow.control.StorageName getStorageName()
        Returns the name for the lookup table in the internal storage.
        Returns:
        the name
      • storageNameTipText

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

        protected void store​(String name,
                             meka.classifiers.multilabel.MultiLabelClassifier cls)
        Stores the classifier in internal storage.
        Parameters:
        name - the name of the classifier
        cls - the classifier
      • retrieve

        protected meka.classifiers.multilabel.MultiLabelClassifier retrieve​(String name)
        Retrieves the classifier from storage.
        Parameters:
        name - the name of the classifier
        Returns:
        the classifier, null if not found
      • trainClassifier

        public TrainClassifierResponseObject trainClassifier​(Dataset dataset,
                                                             String classifier,
                                                             String name)
        Performs training of a classifier and stores it in the model cache.
        Specified by:
        trainClassifier in interface MekaService
        Parameters:
        dataset - the dataset to use for training
        classifier - the classifier setup
        name - the identifier for the model
        Returns:
        null if OK, otherwise error message
      • crossValidateClassifier

        public CrossValidateResponseObject crossValidateClassifier​(Dataset dataset,
                                                                   int seed,
                                                                   int folds,
                                                                   String classifier)
        Cross-validates a classifier on a dataset.
        Specified by:
        crossValidateClassifier in interface MekaService
        Parameters:
        dataset - the dataset to use for cross-validation
        seed - the seed for randomizing the data
        folds - the number of folds to use
        classifier - the classifier setup
        Returns:
        the response
      • transform

        public TransformResponseObject transform​(Dataset dataset,
                                                 String actorName)
        Transforms a dataset using a callable actor on the server.
        Specified by:
        transform in interface MekaService
        Parameters:
        dataset - the data to transform
        actorName - the callable actor to use
        Returns:
        the response with the transformed data or an error message
      • listClassifiers

        public List<String> listClassifiers()
        Returns a list of all classifier models currently stored on the server.
        Specified by:
        listClassifiers in interface MekaService
        Returns:
        the list of classifier models
      • displayString

        protected void displayString​(Dataset dataset)
        For outputting the dataset in debug mode.
        Parameters:
        dataset - the dataset to output