Skip to content
Snippets Groups Projects
Commit 5fc058a1 authored by Xiangrui Meng's avatar Xiangrui Meng
Browse files

[SPARK-9917] [ML] add getMin/getMax and doc for originalMin/origianlMax in MinMaxScaler

hhbyyh

Author: Xiangrui Meng <meng@databricks.com>

Closes #8145 from mengxr/SPARK-9917.
parent a8ab2634
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,9 @@ private[feature] trait MinMaxScalerParams extends Params with HasInputCol with H ...@@ -41,6 +41,9 @@ private[feature] trait MinMaxScalerParams extends Params with HasInputCol with H
val min: DoubleParam = new DoubleParam(this, "min", val min: DoubleParam = new DoubleParam(this, "min",
"lower bound of the output feature range") "lower bound of the output feature range")
/** @group getParam */
def getMin: Double = $(min)
/** /**
* upper bound after transformation, shared by all features * upper bound after transformation, shared by all features
* Default: 1.0 * Default: 1.0
...@@ -49,6 +52,9 @@ private[feature] trait MinMaxScalerParams extends Params with HasInputCol with H ...@@ -49,6 +52,9 @@ private[feature] trait MinMaxScalerParams extends Params with HasInputCol with H
val max: DoubleParam = new DoubleParam(this, "max", val max: DoubleParam = new DoubleParam(this, "max",
"upper bound of the output feature range") "upper bound of the output feature range")
/** @group getParam */
def getMax: Double = $(max)
/** Validates and transforms the input schema. */ /** Validates and transforms the input schema. */
protected def validateAndTransformSchema(schema: StructType): StructType = { protected def validateAndTransformSchema(schema: StructType): StructType = {
val inputType = schema($(inputCol)).dataType val inputType = schema($(inputCol)).dataType
...@@ -115,6 +121,9 @@ class MinMaxScaler(override val uid: String) ...@@ -115,6 +121,9 @@ class MinMaxScaler(override val uid: String)
* :: Experimental :: * :: Experimental ::
* Model fitted by [[MinMaxScaler]]. * Model fitted by [[MinMaxScaler]].
* *
* @param originalMin min value for each original column during fitting
* @param originalMax max value for each original column during fitting
*
* TODO: The transformer does not yet set the metadata in the output column (SPARK-8529). * TODO: The transformer does not yet set the metadata in the output column (SPARK-8529).
*/ */
@Experimental @Experimental
...@@ -136,7 +145,6 @@ class MinMaxScalerModel private[ml] ( ...@@ -136,7 +145,6 @@ class MinMaxScalerModel private[ml] (
/** @group setParam */ /** @group setParam */
def setMax(value: Double): this.type = set(max, value) def setMax(value: Double): this.type = set(max, value)
override def transform(dataset: DataFrame): DataFrame = { override def transform(dataset: DataFrame): DataFrame = {
val originalRange = (originalMax.toBreeze - originalMin.toBreeze).toArray val originalRange = (originalMax.toBreeze - originalMin.toBreeze).toArray
val minArray = originalMin.toArray val minArray = originalMin.toArray
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment