org.apache.lens.ml
Interface LensML

All Known Subinterfaces:
MLService
All Known Implementing Classes:
LensMLClient, LensMLImpl, MLServiceImpl

public interface LensML

Lens's machine learning interface used by client code as well as Lens ML service.


Field Summary
static String NAME
          The Constant NAME.
 
Method Summary
 void deleteModel(String algorithm, String modelID)
          Permanently delete a model instance.
 void deleteTestReport(String algorithm, String reportID)
          Permanently delete a test report instance.
 MLAlgo getAlgoForName(String algorithm)
          Get a algo object instance which could be used to generate a model of the given algorithm.
 Map<String,String> getAlgoParamDescription(String algorithm)
          Get user friendly information about parameters accepted by the algorithm.
 List<String> getAlgorithms()
          Get list of available machine learning algorithms
 MLModel getModel(String algorithm, String modelId)
          Get a model instance given the algorithm name and model ID.
 String getModelPath(String algorithm, String modelID)
          Get the FS location where model instance is saved.
 List<String> getModels(String algorithm)
          Get model IDs for the given algorithm.
 MLTestReport getTestReport(String algorithm, String reportID)
          Get a test report by ID.
 List<String> getTestReports(String algorithm)
          Get test reports for an algorithm.
 Object predict(String algorithm, String modelID, Object[] features)
          Online predict call given a model ID, algorithm name and sample feature values.
 MLTestReport testModel(LensSessionHandle session, String table, String algorithm, String modelID, String outputTable)
          Evaluate model by running it against test data contained in the given table.
 String train(String table, String algorithm, String[] args)
          Create a model using the given HCatalog table as input.
 

Field Detail

NAME

static final String NAME
The Constant NAME.

See Also:
Constant Field Values
Method Detail

getAlgorithms

List<String> getAlgorithms()
Get list of available machine learning algorithms

Returns:

getAlgoParamDescription

Map<String,String> getAlgoParamDescription(String algorithm)
Get user friendly information about parameters accepted by the algorithm.

Parameters:
algorithm - the algorithm
Returns:
map of param key to its help message

getAlgoForName

MLAlgo getAlgoForName(String algorithm)
                      throws LensException
Get a algo object instance which could be used to generate a model of the given algorithm.

Parameters:
algorithm - the algorithm
Returns:
the algo for name
Throws:
LensException - the lens exception

train

String train(String table,
             String algorithm,
             String[] args)
             throws LensException
Create a model using the given HCatalog table as input. The arguments should contain information needeed to generate the model.

Parameters:
table - the table
algorithm - the algorithm
args - the args
Returns:
Unique ID of the model created after training is complete
Throws:
LensException - the lens exception

getModels

List<String> getModels(String algorithm)
                       throws LensException
Get model IDs for the given algorithm.

Parameters:
algorithm - the algorithm
Returns:
the models
Throws:
LensException - the lens exception

getModel

MLModel getModel(String algorithm,
                 String modelId)
                 throws LensException
Get a model instance given the algorithm name and model ID.

Parameters:
algorithm - the algorithm
modelId - the model id
Returns:
the model
Throws:
LensException - the lens exception

getModelPath

String getModelPath(String algorithm,
                    String modelID)
Get the FS location where model instance is saved.

Parameters:
algorithm - the algorithm
modelID - the model id
Returns:
the model path

testModel

MLTestReport testModel(LensSessionHandle session,
                       String table,
                       String algorithm,
                       String modelID,
                       String outputTable)
                       throws LensException
Evaluate model by running it against test data contained in the given table.

Parameters:
session - the session
table - the table
algorithm - the algorithm
modelID - the model id
Returns:
Test report object containing test output table, and various evaluation metrics
Throws:
LensException - the lens exception

getTestReports

List<String> getTestReports(String algorithm)
                            throws LensException
Get test reports for an algorithm.

Parameters:
algorithm - the algorithm
Returns:
the test reports
Throws:
LensException - the lens exception

getTestReport

MLTestReport getTestReport(String algorithm,
                           String reportID)
                           throws LensException
Get a test report by ID.

Parameters:
algorithm - the algorithm
reportID - the report id
Returns:
the test report
Throws:
LensException - the lens exception

predict

Object predict(String algorithm,
               String modelID,
               Object[] features)
               throws LensException
Online predict call given a model ID, algorithm name and sample feature values.

Parameters:
algorithm - the algorithm
modelID - the model id
features - the features
Returns:
prediction result
Throws:
LensException - the lens exception

deleteModel

void deleteModel(String algorithm,
                 String modelID)
                 throws LensException
Permanently delete a model instance.

Parameters:
algorithm - the algorithm
modelID - the model id
Throws:
LensException - the lens exception

deleteTestReport

void deleteTestReport(String algorithm,
                      String reportID)
                      throws LensException
Permanently delete a test report instance.

Parameters:
algorithm - the algorithm
reportID - the report id
Throws:
LensException - the lens exception


Copyright © 2014–2015 Apache Software Foundation. All rights reserved.