Github user feynmanliang commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9229#discussion_r42796199
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/ann/Layer.scala ---
    @@ -226,44 +236,21 @@ private[ann] trait ActivationFunction extends 
Serializable {
     
       /**
        * Implements a function
    -   * @param x input data
    -   * @param y output data
        */
    -  def eval(x: BDM[Double], y: BDM[Double]): Unit
    +  def eval: Double => Double
     
       /**
        * Implements a derivative of a function (needed for the back 
propagation)
    -   * @param x input data
    -   * @param y output data
        */
    -  def derivative(x: BDM[Double], y: BDM[Double]): Unit
    -
    -  /**
    -   * Implements a cross entropy error of a function.
    -   * Needed if the functional layer that contains this function is the 
output layer
    -   * of the network.
    -   * @param target target output
    -   * @param output computed output
    -   * @param result intermediate result
    -   * @return cross-entropy
    -   */
    -  def crossEntropy(target: BDM[Double], output: BDM[Double], result: 
BDM[Double]): Double
    -
    -  /**
    -   * Implements a mean squared error of a function
    -   * @param target target output
    -   * @param output computed output
    -   * @param result intermediate result
    -   * @return mean squared error
    -   */
    -  def squared(target: BDM[Double], output: BDM[Double], result: 
BDM[Double]): Double
    +  def derivative: Double => Double
     }
     
     /**
    - * Implements in-place application of functions
    + * Implements in-place application of functions in the arrays
      */
    -private[ann] object ActivationFunction {
    +private[ann] object UniversalFunction {
    --- End diff --
    
    I found it slightly confusing that the `apply` method of a companion object 
is mutating in place since companion object `apply`s are typically used to 
implement default constructors; we should consider renaming `apply` -> `call` 
if you think that's clearer


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to