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

    https://github.com/apache/spark/pull/13076#discussion_r63452941
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/classification/MultilayerPerceptronClassifier.scala
 ---
    @@ -204,16 +238,26 @@ class MultilayerPerceptronClassifier @Since("1.5.0") (
         val labels = myLayers.last
         val lpData = extractLabeledPoints(dataset)
         val data = lpData.map(lp => LabelConverter.encodeLabeledPoint(lp, 
labels))
    -    val topology = FeedForwardTopology.multiLayerPerceptron(myLayers, true)
    +    val topology = FeedForwardTopology.multiLayerPerceptron(myLayers, 
softmaxOnTop = true)
         val trainer = new FeedForwardTrainer(topology, myLayers(0), 
myLayers.last)
    -    if (isDefined(weights)) {
    -      trainer.setWeights($(weights))
    +    if (isDefined(initialWeights)) {
    +      trainer.setWeights($(initialWeights))
         } else {
           trainer.setSeed($(seed))
         }
    -    trainer.LBFGSOptimizer
    -      .setConvergenceTol($(tol))
    -      .setNumIterations($(maxIter))
    +    if ($(solver) == MultilayerPerceptronClassifier.LBFGS) {
    +      trainer.LBFGSOptimizer
    +        .setConvergenceTol($(tol))
    +        .setNumIterations($(maxIter))
    +    } else if ($(solver) == MultilayerPerceptronClassifier.GD) {
    +      trainer.SGDOptimizer
    +        .setNumIterations($(maxIter))
    +        .setConvergenceTol($(tol))
    +        .setStepSize($(stepSize))
    +    } else {
    +      throw new UnsupportedOperationException(
    --- End diff --
    
    IllegalArgumentException


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