public class PolynomialExpansion extends UnaryTransformer<Vector,Vector,PolynomialExpansion>
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).| Constructor and Description |
|---|
PolynomialExpansion() |
PolynomialExpansion(java.lang.String uid) |
| Modifier and Type | Method and Description |
|---|---|
PolynomialExpansion |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
protected scala.Function1<Vector,Vector> |
createTransformFunc()
Creates the transform function using the given param map.
|
IntParam |
degree()
The polynomial degree to expand, which should be >= 1.
|
static Vector |
expand(Vector v,
int degree) |
int |
getDegree() |
protected DataType |
outputDataType()
Returns the data type of the output column.
|
PolynomialExpansion |
setDegree(int value) |
java.lang.String |
uid()
An immutable unique ID for the object and its derivatives.
|
setInputCol, setOutputCol, transform, transformSchema, validateInputTypetransform, transform, transformtransformSchemaclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitinitializeIfNecessary, initializeLogging, isTraceEnabled, log_, log, logDebug, logDebug, logError, logError, logInfo, logInfo, logName, logTrace, logTrace, logWarning, logWarningclear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn, validateParamstoStringpublic PolynomialExpansion(java.lang.String uid)
public PolynomialExpansion()
public java.lang.String uid()
Identifiablepublic IntParam degree()
public int getDegree()
public PolynomialExpansion setDegree(int value)
protected scala.Function1<Vector,Vector> createTransformFunc()
UnaryTransformercreateTransformFunc in class UnaryTransformer<Vector,Vector,PolynomialExpansion>protected DataType outputDataType()
UnaryTransformeroutputDataType in class UnaryTransformer<Vector,Vector,PolynomialExpansion>public PolynomialExpansion copy(ParamMap extra)
Paramscopy in interface Paramscopy in class UnaryTransformer<Vector,Vector,PolynomialExpansion>extra - (undocumented)defaultCopy()