@Path(value="/ml") @Produces(value={"application/xml","application/json"}) public class MLServiceResource extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ML_UP_MESSAGE
Message indicating if ML service is up
|
Constructor and Description |
---|
MLServiceResource()
Instantiates a new ML service resource.
|
Modifier and Type | Method and Description |
---|---|
javax.ws.rs.core.Response |
clearModelCache()
Clear model cache (for admin use).
|
String |
deleteModel(String algorithm,
String modelID)
Delete a model given model ID and algorithm name.
|
String |
deleteTestReport(String algorithm,
String reportID)
DELETE a report given the algorithm name and report ID.
|
StringList |
getAlgoNames()
Get a list of algos available
|
ModelMetadata |
getModelMetadata(String algorithm,
String modelID)
Get metadata of the model given algorithm and model ID.
|
StringList |
getModelsForAlgo(String algorithm)
Get model ID list for a given algorithm.
|
StringList |
getParamDescription(String algorithm)
Gets the human readable param description of an algorithm
|
StringList |
getReportsForAlgorithm(String algoritm)
Get list of reports for a given algorithm.
|
TestReport |
getTestReport(String algorithm,
String reportID)
Get a single test report given the algorithm name and report id.
|
String |
mlResourceUp()
Indicates if ML resource is up
|
String |
predict(String algorithm,
String modelID,
javax.ws.rs.core.UriInfo uriInfo)
Predict.
|
String |
test(String algorithm,
String modelID,
String table,
LensSessionHandle session,
String outputTable)
Run a test on a model for an algorithm.
|
String |
train(String algorithm,
javax.ws.rs.core.MultivaluedMap<String,String> form)
Train a model given an algorithm name and algorithm parameters
|
public static final String ML_UP_MESSAGE
public MLServiceResource()
@GET public String mlResourceUp()
@GET @Path(value="algos") public StringList getAlgoNames()
@GET @Path(value="algos/{algorithm}") public StringList getParamDescription(@PathParam(value="algorithm") String algorithm)
algorithm
- the algorithm@GET @Path(value="models/{algorithm}") public StringList getModelsForAlgo(@PathParam(value="algorithm") String algorithm) throws LensException
algorithm
- algorithm nameLensException
- the lens exception@GET @Path(value="models/{algorithm}/{modelID}") public ModelMetadata getModelMetadata(@PathParam(value="algorithm") String algorithm, @PathParam(value="modelID") String modelID) throws LensException
algorithm
- algorithm namemodelID
- model IDLensException
- the lens exception@DELETE @Consumes(value={"application/xml","application/json","text/plain"}) @Path(value="models/{algorithm}/{modelID}") public String deleteModel(@PathParam(value="algorithm") String algorithm, @PathParam(value="modelID") String modelID) throws LensException
algorithm
- the algorithmmodelID
- the model idLensException
- the lens exception@POST @Consumes(value="application/x-www-form-urlencoded") @Path(value="{algorithm}/train") public String train(@PathParam(value="algorithm") String algorithm, javax.ws.rs.core.MultivaluedMap<String,String> form) throws LensException
Following parameters are mandatory and must be passed as part of the form
algorithm
- algorithm nameform
- form dataLensException
- the lens exception@DELETE @Path(value="clearModelCache") @Produces(value="text/plain") public javax.ws.rs.core.Response clearModelCache()
@POST @Path(value="test/{table}/{algorithm}/{modelID}") @Consumes(value="multipart/form-data") public String test(@PathParam(value="algorithm") String algorithm, @PathParam(value="modelID") String modelID, @PathParam(value="table") String table, LensSessionHandle session, String outputTable) throws LensException
algorithm
- algorithm namemodelID
- model IDtable
- Hive table to run test onsession
- Lens session ID. This session ID will be used to run the test queryLensException
- the lens exception@GET @Path(value="reports/{algorithm}") public StringList getReportsForAlgorithm(@PathParam(value="algorithm") String algoritm) throws LensException
algoritm
- the algoritmLensException
- the lens exception@GET @Path(value="reports/{algorithm}/{reportID}") public TestReport getTestReport(@PathParam(value="algorithm") String algorithm, @PathParam(value="reportID") String reportID) throws LensException
algorithm
- the algorithmreportID
- the report idLensException
- the lens exception@DELETE @Path(value="reports/{algorithm}/{reportID}") @Consumes(value={"application/xml","application/json","text/plain"}) public String deleteTestReport(@PathParam(value="algorithm") String algorithm, @PathParam(value="reportID") String reportID) throws LensException
algorithm
- the algorithmreportID
- the report idLensException
- the lens exception@GET @Path(value="/predict/{algorithm}/{modelID}") @Produces(value={"application/atom+xml","application/json"}) public String predict(@PathParam(value="algorithm") String algorithm, @PathParam(value="modelID") String modelID, @Context javax.ws.rs.core.UriInfo uriInfo) throws LensException
algorithm
- the algorithmmodelID
- the model iduriInfo
- the uri infoLensException
- the lens exceptionCopyright © 2014–2018 Apache Software Foundation. All rights reserved.