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

    https://github.com/apache/spark/pull/7621#discussion_r35824469
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/classification/MultilayerPerceptronClassifier.scala
 ---
    @@ -0,0 +1,188 @@
    +/*
    + * 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.spark.ml.classification
    +
    +import org.apache.spark.annotation.Experimental
    +import org.apache.spark.ml.param.shared.{HasTol, HasMaxIter, HasSeed}
    +import org.apache.spark.ml.{PredictorParams, PredictionModel, Predictor}
    +import org.apache.spark.ml.param.{IntParam, ParamValidators, 
IntArrayParam, ParamMap}
    +import org.apache.spark.ml.util.Identifiable
    +import org.apache.spark.ml.ann.{FeedForwardTrainer, FeedForwardTopology}
    +import org.apache.spark.mllib.linalg.{Vectors, Vector}
    +import org.apache.spark.mllib.regression.LabeledPoint
    +import org.apache.spark.sql.DataFrame
    +
    +/** Params for Multilayer Perceptron. */
    +private[ml] trait MultilayerPerceptronParams extends PredictorParams
    +with HasSeed with HasMaxIter with HasTol {
    +  /**
    +   * Layer sizes including input size and output size.
    +   * @group param
    +   */
    +  final val layers: IntArrayParam = new IntArrayParam(this, "layers",
    +    "Sizes of layers from input layer to output layer" +
    +      " E.g., Array(780, 100, 10) means 780 inputs, " +
    +      "one hidden layer with 100 neurons and output layer of 10 neurons.",
    +    // TODO: how to check ALSO that all elements are greater than 0?
    +    ParamValidators.lengthGt(1)
    +  )
    +
    +  /** @group setParam */
    +  def setLayers(value: Array[Int]): this.type = set(layers, value)
    +
    +  /** @group getParam */
    +  final def getLayers: Array[Int] = $(layers)
    +
    +  /**
    +   * Block size for stacking input data in matrices. Speeds up the 
computations.
    +   * Cannot be more than the size of the dataset.
    +   * @group expertParam
    +   */
    +  final val blockSize: IntParam = new IntParam(this, "blockSize",
    +    "Block size for stacking input data in matrices.", 
ParamValidators.gt(0))
    +
    +  /** @group setParam */
    +  def setBlockSize(value: Int): this.type = set(blockSize, value)
    +
    +  /** @group getParam */
    +  final def getBlockSize: Int = $(blockSize)
    +
    +  /**
    +   * Set the maximum number of iterations.
    +   * Default is 100.
    +   * @group setParam
    +   */
    +  def setMaxIter(value: Int): this.type = set(maxIter, value)
    +
    +  /**
    +   * Set the convergence tolerance of iterations.
    +   * Smaller value will lead to higher accuracy with the cost of more 
iterations.
    +   * Default is 1E-4.
    +   * @group setParam
    +   */
    +  def setTol(value: Double): this.type = set(tol, value)
    +
    +  /**
    +   * Set the seed for weights initialization.
    +   * @group setParam
    +   */
    +  def setSeed(value: Long): this.type = set(seed, value)
    +
    +  setDefault(maxIter -> 100, tol -> 1e-4, layers -> Array(1, 1), blockSize 
-> 1)
    --- End diff --
    
    do we want to set the default block size to 1?


---
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