public class MLModelHandler extends Object
MLModelHandler
is responsible for handling/delegating all the model related requests.Modifier and Type | Class and Description |
---|---|
static class |
MLModelHandler.Format |
Constructor and Description |
---|
MLModelHandler() |
Modifier and Type | Method and Description |
---|---|
void |
addStorage(long modelId,
org.wso2.carbon.ml.commons.domain.MLStorage storage) |
org.wso2.carbon.ml.commons.domain.Workflow |
buildModel(int tenantId,
String userName,
long modelId)
Build a ML model asynchronously and persist the built model in a given storage.
|
org.wso2.carbon.ml.commons.domain.MLModelData |
createModel(org.wso2.carbon.ml.commons.domain.MLModelData model)
Create a new model.
|
void |
deleteModel(int tenantId,
String userName,
long modelId) |
String |
exportAsPMML(org.wso2.carbon.ml.commons.domain.MLModel model)
Export a ML model in PMML format.
|
List<org.wso2.carbon.ml.commons.domain.MLModelData> |
getAllModels(int tenantId,
String userName) |
List<org.wso2.carbon.ml.commons.domain.ClusterPoint> |
getClusterPoints(int tenantId,
String userName,
long datasetId,
String featureListString,
int noOfClusters) |
org.wso2.carbon.ml.commons.domain.MLModelData |
getModel(int tenantId,
String userName,
long modelId) |
org.wso2.carbon.ml.commons.domain.MLModelData |
getModel(int tenantId,
String userName,
String modelName) |
org.wso2.carbon.ml.commons.domain.ModelSummary |
getModelSummary(long modelId)
Get the summary of a model
|
boolean |
isValidModelId(int tenantId,
String userName,
long modelId) |
boolean |
isValidModelStatus(long modelId,
int tenantId,
String userName) |
List<?> |
predict(int tenantId,
String userName,
long modelId,
List<String[]> data) |
List<?> |
predict(int tenantId,
String userName,
long modelId,
List<String[]> data,
double percentile) |
List<?> |
predict(int tenantId,
String userName,
long modelId,
String dataFormat,
InputStream dataStream) |
List<?> |
predict(int tenantId,
String userName,
long modelId,
String dataFormat,
InputStream dataStream,
double percentile) |
String |
publishModel(int tenantId,
String userName,
long modelId,
MLModelHandler.Format mode)
Publish a ML model to registry.
|
org.wso2.carbon.ml.commons.domain.MLModel |
retrieveModel(long modelId) |
String |
streamingPredict(int tenantId,
String userName,
long modelId,
String dataFormat,
String columnHeader,
InputStream dataStream) |
String |
streamingPredict(int tenantId,
String userName,
long modelId,
String dataFormat,
String columnHeader,
InputStream dataStream,
double percentile) |
public org.wso2.carbon.ml.commons.domain.MLModelData createModel(org.wso2.carbon.ml.commons.domain.MLModelData model) throws MLModelHandlerException
model
- model to be created.MLModelHandlerException
public void deleteModel(int tenantId, String userName, long modelId) throws MLModelHandlerException
MLModelHandlerException
public org.wso2.carbon.ml.commons.domain.MLModelData getModel(int tenantId, String userName, String modelName) throws MLModelHandlerException
MLModelHandlerException
public org.wso2.carbon.ml.commons.domain.MLModelData getModel(int tenantId, String userName, long modelId) throws MLModelHandlerException
MLModelHandlerException
public List<org.wso2.carbon.ml.commons.domain.MLModelData> getAllModels(int tenantId, String userName) throws MLModelHandlerException
MLModelHandlerException
public boolean isValidModelId(int tenantId, String userName, long modelId) throws MLModelHandlerException
MLModelHandlerException
public boolean isValidModelStatus(long modelId, int tenantId, String userName) throws MLModelHandlerException
MLModelHandlerException
public void addStorage(long modelId, org.wso2.carbon.ml.commons.domain.MLStorage storage) throws MLModelHandlerException
modelId
- unique id of the modelstorage
- MLStorage to be updatedMLModelHandlerException
public org.wso2.carbon.ml.commons.domain.ModelSummary getModelSummary(long modelId) throws MLModelHandlerException
modelId
- ID of the modelMLModelHandlerException
public org.wso2.carbon.ml.commons.domain.Workflow buildModel(int tenantId, String userName, long modelId) throws MLModelHandlerException, MLModelBuilderException
modelId
- id of the model to be built.tenantId
- tenant iduserName
- tenant user nameMLModelHandlerException
MLModelBuilderException
public List<?> predict(int tenantId, String userName, long modelId, String dataFormat, InputStream dataStream) throws MLModelHandlerException
MLModelHandlerException
public String streamingPredict(int tenantId, String userName, long modelId, String dataFormat, String columnHeader, InputStream dataStream) throws MLModelHandlerException
MLModelHandlerException
public List<?> predict(int tenantId, String userName, long modelId, List<String[]> data) throws MLModelHandlerException
MLModelHandlerException
public List<?> predict(int tenantId, String userName, long modelId, String dataFormat, InputStream dataStream, double percentile) throws MLModelHandlerException
MLModelHandlerException
public String streamingPredict(int tenantId, String userName, long modelId, String dataFormat, String columnHeader, InputStream dataStream, double percentile) throws MLModelHandlerException
MLModelHandlerException
public List<?> predict(int tenantId, String userName, long modelId, List<String[]> data, double percentile) throws MLModelHandlerException
MLModelHandlerException
public org.wso2.carbon.ml.commons.domain.MLModel retrieveModel(long modelId) throws MLModelHandlerException
MLModelHandlerException
public String publishModel(int tenantId, String userName, long modelId, MLModelHandler.Format mode) throws org.apache.hadoop.fs.InvalidRequestException, MLModelPublisherException, MLModelHandlerException, MLPmmlExportException
tenantId
- Unique ID of the tenant.userName
- Username of the user.modelId
- Unique ID of the built ML modelInvalidRequestException,
- MLModelPublisherException, MLModelHandlerExceptionorg.apache.hadoop.fs.InvalidRequestException
MLModelPublisherException
MLModelHandlerException
MLPmmlExportException
public List<org.wso2.carbon.ml.commons.domain.ClusterPoint> getClusterPoints(int tenantId, String userName, long datasetId, String featureListString, int noOfClusters) throws MLMalformedDatasetException, MLModelHandlerException
public String exportAsPMML(org.wso2.carbon.ml.commons.domain.MLModel model) throws MLPmmlExportException
model
- the model to be exportedMLPmmlExportException
Copyright © 2015 WSO2, Inc.. All Rights Reserved.