|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lens.ml.LensMLImpl
public class LensMLImpl
The Class LensMLImpl.
Field Summary | |
---|---|
static org.apache.commons.logging.Log |
LOG
The Constant LOG. |
Fields inherited from interface org.apache.lens.ml.LensML |
---|
NAME |
Constructor Summary | |
---|---|
LensMLImpl(org.apache.hadoop.hive.conf.HiveConf conf)
Instantiates a new lens ml impl. |
Method Summary | |
---|---|
void |
clearModels()
Clear models. |
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 |
org.apache.hadoop.hive.conf.HiveConf |
getConf()
|
org.apache.hadoop.hive.conf.HiveConf |
getHiveConf()
|
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. |
void |
init(org.apache.hadoop.hive.conf.HiveConf hiveConf)
Inits the. |
Object |
predict(String algorithm,
String modelID,
Object[] features)
Online predict call given a model ID, algorithm name and sample feature values. |
void |
setSparkContext(org.apache.spark.api.java.JavaSparkContext jsc)
Use an existing Spark context. |
void |
start()
Start. |
void |
stop()
Stop. |
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. |
MLTestReport |
testModel(LensSessionHandle sessionHandle,
String table,
String algorithm,
String modelID,
TestQueryRunner queryRunner,
String outputTable)
Evaluate a model. |
MLTestReport |
testModelRemote(LensSessionHandle sessionHandle,
String table,
String algorithm,
String modelID,
String queryApiUrl,
String outputTable)
Test a model in embedded mode. |
String |
train(String table,
String algorithm,
String[] args)
Create a model using the given HCatalog table as input. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final org.apache.commons.logging.Log LOG
Constructor Detail |
---|
public LensMLImpl(org.apache.hadoop.hive.conf.HiveConf conf)
conf
- the confMethod Detail |
---|
public org.apache.hadoop.hive.conf.HiveConf getConf()
public void setSparkContext(org.apache.spark.api.java.JavaSparkContext jsc)
jsc
- JavaSparkContext instancepublic List<String> getAlgorithms()
LensML
getAlgorithms
in interface LensML
public MLAlgo getAlgoForName(String algorithm) throws LensException
LensML
getAlgoForName
in interface LensML
algorithm
- the algorithm
LensException
- the lens exceptionpublic String train(String table, String algorithm, String[] args) throws LensException
LensML
train
in interface LensML
table
- the tablealgorithm
- the algorithmargs
- the args
LensException
- the lens exceptionpublic List<String> getModels(String algorithm) throws LensException
LensML
getModels
in interface LensML
algorithm
- the algorithm
LensException
- the lens exceptionpublic MLModel getModel(String algorithm, String modelId) throws LensException
LensML
getModel
in interface LensML
algorithm
- the algorithmmodelId
- the model id
LensException
- the lens exceptionpublic void init(org.apache.hadoop.hive.conf.HiveConf hiveConf)
hiveConf
- the hive confpublic void start()
public void stop()
public org.apache.hadoop.hive.conf.HiveConf getHiveConf()
public void clearModels()
public String getModelPath(String algorithm, String modelID)
LensML
getModelPath
in interface LensML
algorithm
- the algorithmmodelID
- the model id
public MLTestReport testModel(LensSessionHandle session, String table, String algorithm, String modelID, String outputTable) throws LensException
LensML
testModel
in interface LensML
session
- the sessiontable
- the tablealgorithm
- the algorithmmodelID
- the model id
LensException
- the lens exceptionpublic MLTestReport testModelRemote(LensSessionHandle sessionHandle, String table, String algorithm, String modelID, String queryApiUrl, String outputTable) throws LensException
sessionHandle
- the session handletable
- the tablealgorithm
- the algorithmmodelID
- the model idqueryApiUrl
- the query api url
LensException
- the lens exceptionpublic MLTestReport testModel(LensSessionHandle sessionHandle, String table, String algorithm, String modelID, TestQueryRunner queryRunner, String outputTable) throws LensException
This call also required a query runner. Query runner is responsible for executing the evaluation query against Lens server.
sessionHandle
- the session handletable
- the tablealgorithm
- the algorithmmodelID
- the model idqueryRunner
- the query runneroutputTable
- table where test output will be written
LensException
- the lens exceptionpublic List<String> getTestReports(String algorithm) throws LensException
LensML
getTestReports
in interface LensML
algorithm
- the algorithm
LensException
- the lens exceptionpublic MLTestReport getTestReport(String algorithm, String reportID) throws LensException
LensML
getTestReport
in interface LensML
algorithm
- the algorithmreportID
- the report id
LensException
- the lens exceptionpublic Object predict(String algorithm, String modelID, Object[] features) throws LensException
LensML
predict
in interface LensML
algorithm
- the algorithmmodelID
- the model idfeatures
- the features
LensException
- the lens exceptionpublic void deleteModel(String algorithm, String modelID) throws LensException
LensML
deleteModel
in interface LensML
algorithm
- the algorithmmodelID
- the model id
LensException
- the lens exceptionpublic void deleteTestReport(String algorithm, String reportID) throws LensException
LensML
deleteTestReport
in interface LensML
algorithm
- the algorithmreportID
- the report id
LensException
- the lens exceptionpublic Map<String,String> getAlgoParamDescription(String algorithm)
LensML
getAlgoParamDescription
in interface LensML
algorithm
- the algorithm
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |