org.wso2.extension.siddhi.execution.ml

## Class ModelHandler

- java.lang.Object
- - org.wso2.extension.siddhi.execution.ml.ModelHandler

-     public class ModelHandler
      extends Object

  Model Handler

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `FILE_STORAGE_PREFIX`
    `static String` | `PATH_TO_GOVERNANCE_REGISTRY`
    `static String` | `REGISTRY_STORAGE_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ModelHandler(String modelStorageLocation)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getAlgorithmClass()` Returns the algorithm class - classification, numerical prediction or clustering
    `Map<String,Integer>` | `getFeatures()` Return the map containing <feature-name, index> pairs
    `org.wso2.carbon.ml.commons.domain.MLModel` | `getMlModel()`
    `List<Integer>` | `getNewToOldIndicesList()` Get new to old indices list of this model.
    `String` | `getResponseVariable()` Return the response variable of the model
    `Object` | `predict(String[] data, String outputType)` Predict the value using the feature values.
    `Object` | `predict(String[] data, String outputType, double percentile)` Predict the value using the feature values.
    `Object` | `predict(String[] data, String outputType, org.wso2.carbon.ml.core.h2o.POJOPredictor pojoPredictor)` Predict the value using the feature values with POJO predictor.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### FILE_STORAGE_PREFIX

          public static final String FILE_STORAGE_PREFIX

      See Also:
        Constant Field Values

    - #### REGISTRY_STORAGE_PREFIX

          public static final String REGISTRY_STORAGE_PREFIX

      See Also:
        Constant Field Values

    - #### PATH_TO_GOVERNANCE_REGISTRY

          public static final String PATH_TO_GOVERNANCE_REGISTRY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ModelHandler

          public ModelHandler(String modelStorageLocation)
                       throws ClassNotFoundException,
                              URISyntaxException,
                              org.wso2.carbon.ml.core.exceptions.MLInputAdapterException,
                              IOException

      Parameters:
        `modelStorageLocation` - MLModel storage location
      Throws:
        `ClassNotFoundException` - class not found exception
        `URISyntaxException` - URI syntax exception
        `org.wso2.carbon.ml.core.exceptions.MLInputAdapterException` - ML input adapter exception
        `IOException` - java IO exception

  - ### Method Detail

    - #### predict

          public Object predict(String[] data,
                                String outputType)
                         throws org.wso2.carbon.ml.core.exceptions.MLModelHandlerException

      Predict the value using the feature values.
      Parameters:
        `data` - feature values array
        `outputType` - data type of the output
      Returns:
        predicted value
      Throws:
        `org.wso2.carbon.ml.core.exceptions.MLModelHandlerException` - throws ML model handler exception

    - #### predict

          public Object predict(String[] data,
                                String outputType,
                                double percentile)
                         throws org.wso2.carbon.ml.core.exceptions.MLModelHandlerException

      Predict the value using the feature values.
      Parameters:
        `data` - feature values array
        `outputType` - output type
        `percentile` - percentile value for predictions
      Returns:
        predicted value
      Throws:
        `org.wso2.carbon.ml.core.exceptions.MLModelHandlerException` - throws ML model handler exception

    - #### predict

          public Object predict(String[] data,
                                String outputType,
                                org.wso2.carbon.ml.core.h2o.POJOPredictor pojoPredictor)
                         throws org.wso2.carbon.ml.core.exceptions.MLModelHandlerException

      Predict the value using the feature values with POJO predictor.
      Parameters:
        `data` - feature values array
        `outputType` - data type of the output
        `pojoPredictor` - POJO predictor
      Returns:
        predicted value
      Throws:
        `org.wso2.carbon.ml.core.exceptions.MLModelHandlerException` - ML model handler exception

    - #### getFeatures

          public Map<String,Integer> getFeatures()

      Return the map containing <feature-name, index> pairs
      Returns:
        the <feature-name, feature-index> map of the MLModel

    - #### getNewToOldIndicesList

          public List<Integer> getNewToOldIndicesList()

      Get new to old indices list of this model.
      Returns:
        the new to old indices list of the MLModel

    - #### getResponseVariable

          public String getResponseVariable()

      Return the response variable of the model
      Returns:
        the response variable of the MLModel

    - #### getAlgorithmClass

          public String getAlgorithmClass()

      Returns the algorithm class - classification, numerical prediction or clustering
      Returns:
        the algorithm class

    - #### getMlModel

          public org.wso2.carbon.ml.commons.domain.MLModel getMlModel()

      Returns:
        the model

Copyright © 2017 WSO2. All rights reserved.