org.apache.spark.ml.feature
Class PolynomialExpansion

Object
  extended by org.apache.spark.ml.PipelineStage
      extended by org.apache.spark.ml.Transformer
          extended by org.apache.spark.ml.UnaryTransformer<Vector,Vector,PolynomialExpansion>
              extended by org.apache.spark.ml.feature.PolynomialExpansion
All Implemented Interfaces:
java.io.Serializable, Logging, Params

public class PolynomialExpansion
extends UnaryTransformer<Vector,Vector,PolynomialExpansion>

:: Experimental :: Perform feature expansion in a polynomial space. As said in wikipedia of Polynomial Expansion, which is available at http://en.wikipedia.org/wiki/Polynomial_expansion, "In mathematics, an expansion of a product of sums expresses it as a sum of products by using the fact that multiplication distributes over addition". Take a 2-variable feature vector as an example: (x, y), if we want to expand it with degree 2, then we get (x, x * x, y, x * y, y * y).

See Also:
Serialized Form

Constructor Summary
PolynomialExpansion()
           
PolynomialExpansion(String uid)
           
 
Method Summary
 PolynomialExpansion copy(ParamMap extra)
          Creates a copy of this instance with the same UID and some extra params.
 IntParam degree()
          The polynomial degree to expand, which should be >= 1.
static Vector expand(Vector v, int degree)
           
 int getDegree()
           
 PolynomialExpansion setDegree(int value)
           
 String uid()
           
 
Methods inherited from class org.apache.spark.ml.UnaryTransformer
setInputCol, setOutputCol, transform, transformSchema
 
Methods inherited from class org.apache.spark.ml.Transformer
transform, transform, transform
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.spark.Logging
initializeIfNecessary, initializeLogging, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarning
 
Methods inherited from interface org.apache.spark.ml.param.Params
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, setDefault, shouldOwn, validateParams
 

Constructor Detail

PolynomialExpansion

public PolynomialExpansion(String uid)

PolynomialExpansion

public PolynomialExpansion()
Method Detail

expand

public static Vector expand(Vector v,
                            int degree)

uid

public String uid()

degree

public IntParam degree()
The polynomial degree to expand, which should be >= 1. A value of 1 means no expansion. Default: 2

Returns:
(undocumented)

getDegree

public int getDegree()

setDegree

public PolynomialExpansion setDegree(int value)

copy

public PolynomialExpansion copy(ParamMap extra)
Description copied from interface: Params
Creates a copy of this instance with the same UID and some extra params. Subclasses should implement this method and set the return type properly.

Specified by:
copy in interface Params
Overrides:
copy in class UnaryTransformer<Vector,Vector,PolynomialExpansion>
Parameters:
extra - (undocumented)
Returns:
(undocumented)
See Also:
defaultCopy()