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)
delete mddel using 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)
get all models
|
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)
get Model using modelId
|
org.wso2.carbon.ml.commons.domain.MLModelData |
getModel(int tenantId,
String userName,
String modelName)
get Model using modelName
|
org.wso2.carbon.ml.commons.domain.ModelSummary |
getModelSummary(long modelId)
Get the summary of a model
|
List<?> |
getProductRecommendations(int tenantId,
String userName,
long modelId,
int userId,
int noOfProducts) |
List<?> |
getUserRecommendations(int tenantId,
String userName,
long modelId,
int productId,
int noOfUsers) |
boolean |
isValidModelId(int tenantId,
String userName,
long modelId)
check validity of modelId
|
boolean |
isValidModelStatus(long modelId,
int tenantId,
String userName)
check validity of model status
|
List<?> |
predict(int tenantId,
String userName,
long modelId,
List<String[]> data) |
List<?> |
predict(int tenantId,
String userName,
long modelId,
List<String[]> data,
double percentile,
boolean skipDecoding) |
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,
boolean skipDecoding) |
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,
boolean skipDecoding) |
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
tenantId
- Unique ID of the tenant.userName
- Username of the user.modelId
- modelId of the model to be deleted.MLModelHandlerException
public org.wso2.carbon.ml.commons.domain.MLModelData getModel(int tenantId, String userName, String modelName) throws MLModelHandlerException
tenantId
- Unique ID of the tenant.userName
- Username of the user.modelName
- modelName of the model to be retrieved.MLModelHandlerException
public org.wso2.carbon.ml.commons.domain.MLModelData getModel(int tenantId, String userName, long modelId) throws MLModelHandlerException
tenantId
- Unique ID of the tenant.userName
- Username of the user.modelId
- modelId of the model to be retrieved.MLModelHandlerException
public List<org.wso2.carbon.ml.commons.domain.MLModelData> getAllModels(int tenantId, String userName) throws MLModelHandlerException
tenantId
- Unique ID of the tenant.userName
- Username of the user.MLModelHandlerException
public boolean isValidModelId(int tenantId, String userName, long modelId) throws MLModelHandlerException
tenantId
- Unique ID of the tenant.userName
- Username of the user.modelId
- modelId to be validatedMLModelHandlerException
public boolean isValidModelStatus(long modelId, int tenantId, String userName) throws MLModelHandlerException
modelId
- modelId of the model which the status needs to be validatedMLModelHandlerException
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, boolean skipDecoding) throws MLModelHandlerException
MLModelHandlerException
public String streamingPredict(int tenantId, String userName, long modelId, String dataFormat, String columnHeader, InputStream dataStream, double percentile, boolean skipDecoding) throws MLModelHandlerException
MLModelHandlerException
public List<?> predict(int tenantId, String userName, long modelId, List<String[]> data, double percentile, boolean skipDecoding) throws MLModelHandlerException
MLModelHandlerException
public List<?> getProductRecommendations(int tenantId, String userName, long modelId, int userId, int noOfProducts) throws MLModelHandlerException
MLModelHandlerException
public List<?> getUserRecommendations(int tenantId, String userName, long modelId, int productId, int noOfUsers) 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 © 2016 WSO2, Inc.. All Rights Reserved.