Skip to content

Conversation

@avulanov
Copy link
Contributor

1.Implement LossFunction trait and implement squared error and cross entropy
loss with it
2.Implement unit test for gradient and loss
3.Implement InPlace trait and in-place layer evaluation
4.Refactor interface for ActivationFunction
5.Update of Layer and LayerModel interfaces
6.Fix random weights assignment
7.Implement memory allocation by MLP model instead of individual layers

These features decreased the memory usage and increased flexibility of
internal API.

@SparkQA
Copy link

SparkQA commented Oct 22, 2015

Test build #44163 has finished for PR 9229 at commit d47310b.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):\n * trait LossFunction\n * trait InPlace\n * class SigmoidLayerWithSquaredError extends Layer\n * class SigmoidLayerModelWithSquaredError extends FunctionalLayerModel(new SigmoidFunction)\n * class SoftmaxLayerWithCrossEntropyLoss extends Layer\n * class SoftmaxLayerModelWithCrossEntropyLoss extends LayerModel with LossFunction\n

@avulanov
Copy link
Contributor Author

@mengxr Could you take a look?

@feynmanliang These changes clash with some of your changes in #8648, sorry, because I simplified the interface of ActivationFunction to Double => Double and forced all computations to be in place. However, your suggestion of UFunc could be very helpful. Can you think of a way rewriting the UniversalFunction object with UFunc so that it does in-place operations? In any case, we have to merge your changes in BreezeUtil.scala either in the original PR or here and improve the scaladoc as you proposed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 indent

@feynmanliang
Copy link
Contributor

Made a pass

@avulanov
Copy link
Contributor Author

@feynmanliang Thank you! I've addressed all comments, except related to the ones vector because it actually depends on the batch size. With regards to UniversalFunction.apply, I could call it explicitly. Does it sound reasonable to you?

@SparkQA
Copy link

SparkQA commented Oct 23, 2015

Test build #44188 has finished for PR 9229 at commit 7864b8f.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Oct 23, 2015

Test build #44190 has finished for PR 9229 at commit 215d249.

  • This patch fails MiMa tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Oct 23, 2015

Test build #44193 has finished for PR 9229 at commit 6f1200c.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 8, 2015

Test build #45311 has finished for PR 9229 at commit 1d29901.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 9, 2015

Test build #45410 has finished for PR 9229 at commit 129c9aa.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@avulanov
Copy link
Contributor Author

@mengxr Could you suggest why it continues to fail? Thanks.

@feynmanliang
Copy link
Contributor

@avulanov On this page search for "*** FAILED ***"

@avulanov
Copy link
Contributor Author

@feynmanliang Thanks for the tip! My unit tests fail. It has a problem with the new RNG in Spark, so I updated the seeds and the asserts. However the fail seems to correspond to the old code: Should converge to a good optimum after the 3rd restart (3rd). The new code has ...after the 5th restart (5th). Could you suggest why it is happening?

@avulanov
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Nov 11, 2015

Test build #45658 has finished for PR 9229 at commit 083a9b3.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@avulanov
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Nov 12, 2015

Test build #45680 has finished for PR 9229 at commit 2a6d644.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Nov 12, 2015

Test build #45698 has finished for PR 9229 at commit e3ca7f1.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@avulanov
Copy link
Contributor Author

@mengxr Could you suggest what would be the best practice to handle zeros in the computation of logarithm of output? https://github.com/avulanov/spark/blob/mlp-refactoring/mllib/src/main/scala/org/apache/spark/ml/ann/LossFunction.scala#L122

@SparkQA
Copy link

SparkQA commented Mar 17, 2016

Test build #53461 has finished for PR 9229 at commit e5bef10.

  • This patch fails from timeout after a configured wait of 250m.
  • This patch merges cleanly.
  • This patch adds no public classes.

@avulanov
Copy link
Contributor Author

@mengxr Rebased to accomodate #9854

@SparkQA
Copy link

SparkQA commented Mar 28, 2016

Test build #54347 has finished for PR 9229 at commit b21b56a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@mengxr
Copy link
Contributor

mengxr commented Mar 31, 2016

@avulanov This PR still has conflicts with master.

avulanov and others added 14 commits March 31, 2016 10:06
1.Implement LossFunction trait and implement squared error and cross entropy
loss with it
2.Implement unit test for gradient and loss
3.Implement InPlace trait and in-place layer evaluation
4.Refactor interface for ActivationFunction
5.Update of Layer and LayerModel interfaces
6.Fix random weights assignment
7.Implement memory allocation by MLP model instead of individual layers

These features decreased the memory usage and increased flexibility of
internal API.
@avulanov
Copy link
Contributor Author

@mengxr That is a project/MimaExcludes.scala. Apparently, it is modified almost every day in the master branch. Rebased.

@SparkQA
Copy link

SparkQA commented Mar 31, 2016

Test build #54646 has finished for PR 9229 at commit 94dcec0.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@avulanov
Copy link
Contributor Author

Build exception unrelated to PR

@mengxr
Copy link
Contributor

mengxr commented Mar 31, 2016

test this please

@SparkQA
Copy link

SparkQA commented Apr 1, 2016

Test build #54671 has finished for PR 9229 at commit 94dcec0.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@mengxr
Copy link
Contributor

mengxr commented Apr 1, 2016

LGTM. Merged into master. Thanks and sorry for the long delay in code review!

@asfgit asfgit closed this in 26867eb Apr 1, 2016
@avulanov
Copy link
Contributor Author

avulanov commented Apr 1, 2016

@mengxr @feynmanliang Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants