flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fobeligi <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-1844] [ml] Add Normaliser to ML library
Date Mon, 08 Jun 2015 15:34:33 GMT
Github user fobeligi commented on a diff in the pull request:

    https://github.com/apache/flink/pull/798#discussion_r31927083
  
    --- Diff: flink-staging/flink-ml/src/main/scala/org/apache/flink/ml/preprocessing/MinMaxScaler.scala
---
    @@ -0,0 +1,254 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.flink.ml.preprocessing
    +
    +import breeze.linalg
    +import breeze.linalg.{max, min}
    +import org.apache.flink.api.common.typeinfo.TypeInformation
    +import org.apache.flink.api.scala._
    +import org.apache.flink.ml._
    +import org.apache.flink.ml.common.{LabeledVector, Parameter, ParameterMap}
    +import org.apache.flink.ml.math.Breeze._
    +import org.apache.flink.ml.math.{BreezeVectorConverter, Vector}
    +import org.apache.flink.ml.pipeline.{FitOperation, TransformOperation, Transformer}
    +import org.apache.flink.ml.preprocessing.MinMaxScaler.{Max, Min}
    +
    +import scala.reflect.ClassTag
    +
    +/** Scales observations, so that all features are in a user-specified range.
    +  * By default for [[MinMaxScaler]] transformer range = [0,1].
    +  *
    +  * This transformer takes a subtype of  [[Vector]] of values and maps it to a
    +  * scaled subtype of [[Vector]] such that each feature lies between a user-specified
range.
    +  *
    +  * This transformer can be prepended to all [[Transformer]] and
    +  * [[org.apache.flink.ml.pipeline.Predictor]] implementations which expect as input
a subtype
    +  * of [[Vector]].
    +  *
    +  * @example
    +  * {{{
    +  *               val trainingDS: DataSet[Vector] = env.fromCollection(data)
    +  *               val transformer = MinMaxScaler().setMin(-1.0)
    +  *
    +  *               transformer.fit(trainingDS)
    +  *               val transformedDS = transformer.transform(trainingDS)
    +  * }}}
    +  *
    +  * =Parameters=
    +  *
    +  * - [[Min]]: The minimum value of the range of the transformed data set; by default
equal to 0
    +  * - [[Max]]: The maximum value of the range of the transformed data set; by default
    +  * equal to 1
    +  */
    +class MinMaxScaler extends Transformer[MinMaxScaler] {
    +
    +  var metricsOption: Option[DataSet[(linalg.Vector[Double], linalg.Vector[Double])]]
= None
    --- End diff --
    
    Yes ^^


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message