org.apache.lens.ml
Class ModelLoader

java.lang.Object
  extended by org.apache.lens.ml.ModelLoader

public final class ModelLoader
extends Object

Load ML models from a FS location.


Field Summary
static org.apache.commons.logging.Log LOG
          The Constant LOG.
static long MODEL_CACHE_SIZE
          The Constant MODEL_CACHE_SIZE.
static long MODEL_CACHE_TIMEOUT
          The Constant MODEL_CACHE_TIMEOUT.
static String MODEL_PATH_BASE_DIR
          The Constant MODEL_PATH_BASE_DIR.
static String MODEL_PATH_BASE_DIR_DEFAULT
          The Constant MODEL_PATH_BASE_DIR_DEFAULT.
static String TEST_REPORT_BASE_DIR
          The Constant TEST_REPORT_BASE_DIR.
static String TEST_REPORT_BASE_DIR_DEFAULT
          The Constant TEST_REPORT_BASE_DIR_DEFAULT.
 
Method Summary
static void clearCache()
          Clear cache.
static void deleteModel(org.apache.hadoop.hive.conf.HiveConf conf, String algorithm, String modelID)
          Delete model.
static void deleteTestReport(org.apache.hadoop.hive.conf.HiveConf conf, String algorithm, String reportID)
          Delete test report.
static org.apache.hadoop.fs.Path getModelLocation(org.apache.hadoop.conf.Configuration conf, String algorithm, String modelID)
          Gets the model location.
static org.apache.hadoop.fs.Path getTestReportPath(org.apache.hadoop.conf.Configuration conf, String algorithm, String report)
          Gets the test report path.
static MLModel loadModel(org.apache.hadoop.conf.Configuration conf, String algorithm, String modelID)
          Load model.
static MLTestReport loadReport(org.apache.hadoop.conf.Configuration conf, String algorithm, String reportID)
          Load report.
static void saveTestReport(org.apache.hadoop.conf.Configuration conf, MLTestReport report)
          Save test report.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODEL_PATH_BASE_DIR

public static final String MODEL_PATH_BASE_DIR
The Constant MODEL_PATH_BASE_DIR.

See Also:
Constant Field Values

MODEL_PATH_BASE_DIR_DEFAULT

public static final String MODEL_PATH_BASE_DIR_DEFAULT
The Constant MODEL_PATH_BASE_DIR_DEFAULT.

See Also:
Constant Field Values

LOG

public static final org.apache.commons.logging.Log LOG
The Constant LOG.


TEST_REPORT_BASE_DIR

public static final String TEST_REPORT_BASE_DIR
The Constant TEST_REPORT_BASE_DIR.

See Also:
Constant Field Values

TEST_REPORT_BASE_DIR_DEFAULT

public static final String TEST_REPORT_BASE_DIR_DEFAULT
The Constant TEST_REPORT_BASE_DIR_DEFAULT.

See Also:
Constant Field Values

MODEL_CACHE_SIZE

public static final long MODEL_CACHE_SIZE
The Constant MODEL_CACHE_SIZE.

See Also:
Constant Field Values

MODEL_CACHE_TIMEOUT

public static final long MODEL_CACHE_TIMEOUT
The Constant MODEL_CACHE_TIMEOUT.

See Also:
Constant Field Values
Method Detail

getModelLocation

public static org.apache.hadoop.fs.Path getModelLocation(org.apache.hadoop.conf.Configuration conf,
                                                         String algorithm,
                                                         String modelID)
Gets the model location.

Parameters:
conf - the conf
algorithm - the algorithm
modelID - the model id
Returns:
the model location

loadModel

public static MLModel loadModel(org.apache.hadoop.conf.Configuration conf,
                                String algorithm,
                                String modelID)
                         throws IOException
Load model.

Parameters:
conf - the conf
algorithm - the algorithm
modelID - the model id
Returns:
the ML model
Throws:
IOException - Signals that an I/O exception has occurred.

clearCache

public static void clearCache()
Clear cache.


getTestReportPath

public static org.apache.hadoop.fs.Path getTestReportPath(org.apache.hadoop.conf.Configuration conf,
                                                          String algorithm,
                                                          String report)
Gets the test report path.

Parameters:
conf - the conf
algorithm - the algorithm
report - the report
Returns:
the test report path

saveTestReport

public static void saveTestReport(org.apache.hadoop.conf.Configuration conf,
                                  MLTestReport report)
                           throws IOException
Save test report.

Parameters:
conf - the conf
report - the report
Throws:
IOException - Signals that an I/O exception has occurred.

loadReport

public static MLTestReport loadReport(org.apache.hadoop.conf.Configuration conf,
                                      String algorithm,
                                      String reportID)
                               throws IOException
Load report.

Parameters:
conf - the conf
algorithm - the algorithm
reportID - the report id
Returns:
the ML test report
Throws:
IOException - Signals that an I/O exception has occurred.

deleteModel

public static void deleteModel(org.apache.hadoop.hive.conf.HiveConf conf,
                               String algorithm,
                               String modelID)
                        throws IOException
Delete model.

Parameters:
conf - the conf
algorithm - the algorithm
modelID - the model id
Throws:
IOException - Signals that an I/O exception has occurred.

deleteTestReport

public static void deleteTestReport(org.apache.hadoop.hive.conf.HiveConf conf,
                                    String algorithm,
                                    String reportID)
                             throws IOException
Delete test report.

Parameters:
conf - the conf
algorithm - the algorithm
reportID - the report id
Throws:
IOException - Signals that an I/O exception has occurred.


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