org.apache.lens.ml.spark.algos
Class BaseSparkAlgo

java.lang.Object
  extended by org.apache.lens.ml.spark.algos.BaseSparkAlgo
All Implemented Interfaces:
MLAlgo
Direct Known Subclasses:
DecisionTreeAlgo, LogisticRegressionAlgo, NaiveBayesAlgo, SVMAlgo

public abstract class BaseSparkAlgo
extends Object
implements MLAlgo

The Class BaseSparkAlgo.


Field Summary
static org.apache.commons.logging.Log LOG
          The Constant LOG.
 
Constructor Summary
BaseSparkAlgo(String name, String description)
          Instantiates a new base spark algo.
 
Method Summary
 void configure(LensConf configuration)
          Configure.
 Map<String,String> getArgUsage()
           
 LensConf getConf()
           
 String getDescription()
           
 String getName()
           
 double getParamValue(String param, double defaultVal)
          Gets the param value.
 int getParamValue(String param, int defaultVal)
          Gets the param value.
abstract  void parseAlgoParams(Map<String,String> params)
          Parses the algo params.
 void parseParams(String[] args)
          Parses the params.
 void setSparkContext(org.apache.spark.api.java.JavaSparkContext sparkContext)
           
 MLModel<?> train(LensConf conf, String db, String table, String modelId, String... params)
          Train.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

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

Constructor Detail

BaseSparkAlgo

public BaseSparkAlgo(String name,
                     String description)
Instantiates a new base spark algo.

Parameters:
name - the name
description - the description
Method Detail

setSparkContext

public void setSparkContext(org.apache.spark.api.java.JavaSparkContext sparkContext)

getConf

public LensConf getConf()
Specified by:
getConf in interface MLAlgo

configure

public void configure(LensConf configuration)
Description copied from interface: MLAlgo
Configure.

Specified by:
configure in interface MLAlgo
Parameters:
configuration - the configuration

train

public MLModel<?> train(LensConf conf,
                        String db,
                        String table,
                        String modelId,
                        String... params)
                 throws LensException
Description copied from interface: MLAlgo
Train.

Specified by:
train in interface MLAlgo
Parameters:
conf - the conf
db - the db
table - the table
modelId - the model id
params - the params
Returns:
the ML model
Throws:
LensException - the lens exception

parseParams

public void parseParams(String[] args)
Parses the params.

Parameters:
args - the args

getParamValue

public double getParamValue(String param,
                            double defaultVal)
Gets the param value.

Parameters:
param - the param
defaultVal - the default val
Returns:
the param value

getParamValue

public int getParamValue(String param,
                         int defaultVal)
Gets the param value.

Parameters:
param - the param
defaultVal - the default val
Returns:
the param value

getName

public String getName()
Specified by:
getName in interface MLAlgo

getDescription

public String getDescription()
Specified by:
getDescription in interface MLAlgo

getArgUsage

public Map<String,String> getArgUsage()

parseAlgoParams

public abstract void parseAlgoParams(Map<String,String> params)
Parses the algo params.

Parameters:
params - the params


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