{"action":"created","issue":{"url":"https://api.github.com/repos/deeplearning4j/deeplearning4j/issues/234","labels_url":"https://api.github.com/repos/deeplearning4j/deeplearning4j/issues/234/labels{/name}","comments_url":"https://api.github.com/repos/deeplearning4j/deeplearning4j/issues/234/comments","events_url":"https://api.github.com/repos/deeplearning4j/deeplearning4j/issues/234/events","html_url":"https://github.com/deeplearning4j/deeplearning4j/pull/234","id":72889209,"number":234,"title":"configuration serialization - layer factory","user":{"login":"EronWright","id":1775518,"avatar_url":"https://avatars.githubusercontent.com/u/1775518?v=3","gravatar_id":"","url":"https://api.github.com/users/EronWright","html_url":"https://github.com/EronWright","followers_url":"https://api.github.com/users/EronWright/followers","following_url":"https://api.github.com/users/EronWright/following{/other_user}","gists_url":"https://api.github.com/users/EronWright/gists{/gist_id}","starred_url":"https://api.github.com/users/EronWright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EronWright/subscriptions","organizations_url":"https://api.github.com/users/EronWright/orgs","repos_url":"https://api.github.com/users/EronWright/repos","events_url":"https://api.github.com/users/EronWright/events{/privacy}","received_events_url":"https://api.github.com/users/EronWright/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-04T00:30:15Z","updated_at":"2015-05-04T02:30:04Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/deeplearning4j/deeplearning4j/pulls/234","html_url":"https://github.com/deeplearning4j/deeplearning4j/pull/234","diff_url":"https://github.com/deeplearning4j/deeplearning4j/pull/234.diff","patch_url":"https://github.com/deeplearning4j/deeplearning4j/pull/234.patch"},"body":"Here is the next step in a series of improvements for high-fidelity serialization of `MultiLayerConfiguration`.    The `NeuralNetConfiguration` no longer takes `LayerFactory` directly, instead it takes a set of layer configuration types (`RBM`, `AutoEncoder`, etc).   `LayerFactory` continues to be used as before, but later when a network is actually constructed.   `LayerFactories` and `DefaultLayerFactory` contain logic to translate the configuration objects.\r\n\r\nA nice aspect of this change is that layer-specific configuration properties (such as `ConvolutionType`) could be moved to layer-specific configuration classes.   This may help with the goal of improving the stability of the API.\r\n\r\nI suggest we move `LayerFactory` out of the API package, since it is now an implementation detail.\r\n\r\nNote that some layer types aren't supported (`ConvolutionLayer`/`RNTN`/`SubsamplingLayer`).   I will update the PR once Adam's changes related to those layers come in.\r\n\r\nSample JSON:\r\n```\r\n{\r\n  \"hiddenLayerSizes\" : [ 3 ],\r\n  \"confs\" : [ {\r\n    \"sparsity\" : 0.0,\r\n    \"useAdaGrad\" : true,\r\n    \"lr\" : 0.10000000149011612,\r\n    \"corruptionLevel\" : 0.30000001192092896,\r\n    \"numIterations\" : 100,\r\n    \"momentum\" : 0.9,\r\n    \"l2\" : 2.0E-4,\r\n    \"useRegularization\" : true,\r\n    \"momentumAfter\" : null,\r\n    \"resetAdaGradIterations\" : -1,\r\n    \"numLineSearchIterations\" : 100,\r\n    \"dropOut\" : 0.0,\r\n    \"applySparsity\" : false,\r\n    \"weightInit\" : \"DISTRIBUTION\",\r\n    \"optimizationAlgo\" : \"LBFGS\",\r\n    \"lossFunction\" : \"RMSE_XENT\",\r\n    \"constrainGradientToUnitNorm\" : true,\r\n    \"rng\" : {\r\n      \"default\" : {\r\n        \"seed\" : 1430697874911\r\n      }\r\n    },\r\n    \"dist\" : {\r\n      \"uniform\" : {\r\n        \"lower\" : 0.0,\r\n        \"upper\" : 1.0\r\n      }\r\n    },\r\n    \"layer\" : {\r\n      \"RBM\" : { }\r\n    },\r\n    \"nIn\" : 4,\r\n    \"nOut\" : 3,\r\n    \"activationFunction\" : \"tanh\",\r\n    \"visibleUnit\" : \"GAUSSIAN\",\r\n    \"hiddenUnit\" : \"RECTIFIED\",\r\n    \"k\" : 1,\r\n    \"weightShape\" : [ 4, 3 ],\r\n    \"filterSize\" : [ 2, 2, 2, 2 ],\r\n    \"stride\" : [ 2, 2 ],\r\n    \"kernel\" : 5,\r\n    \"batchSize\" : 0,\r\n    \"minimize\" : false,\r\n    \"convolutionType\" : \"MAX\",\r\n    \"stepFunction\" : \"org.deeplearning4j.optimize.stepfunctions.DefaultStepFunction\"\r\n  }, {\r\n    \"sparsity\" : 0.0,\r\n    \"useAdaGrad\" : true,\r\n    \"lr\" : 0.10000000149011612,\r\n    \"corruptionLevel\" : 0.30000001192092896,\r\n    \"numIterations\" : 100,\r\n    \"momentum\" : 0.9,\r\n    \"l2\" : 2.0E-4,\r\n    \"useRegularization\" : true,\r\n    \"momentumAfter\" : null,\r\n    \"resetAdaGradIterations\" : -1,\r\n    \"numLineSearchIterations\" : 100,\r\n    \"dropOut\" : 0.0,\r\n    \"applySparsity\" : false,\r\n    \"weightInit\" : \"ZERO\",\r\n    \"optimizationAlgo\" : \"LBFGS\",\r\n    \"lossFunction\" : \"MCXENT\",\r\n    \"constrainGradientToUnitNorm\" : true,\r\n    \"rng\" : {\r\n      \"default\" : {\r\n        \"seed\" : 1430697874911\r\n      }\r\n    },\r\n    \"dist\" : {\r\n      \"uniform\" : {\r\n        \"lower\" : 0.0,\r\n        \"upper\" : 1.0\r\n      }\r\n    },\r\n    \"layer\" : {\r\n      \"output\" : { }\r\n    },\r\n    \"nIn\" : 4,\r\n    \"nOut\" : 3,\r\n    \"activationFunction\" : \"softmax\",\r\n    \"visibleUnit\" : \"GAUSSIAN\",\r\n    \"hiddenUnit\" : \"RECTIFIED\",\r\n    \"k\" : 1,\r\n    \"weightShape\" : [ 4, 3 ],\r\n    \"filterSize\" : [ 2, 2, 2, 2 ],\r\n    \"stride\" : [ 2, 2 ],\r\n    \"kernel\" : 5,\r\n    \"batchSize\" : 0,\r\n    \"minimize\" : false,\r\n    \"convolutionType\" : \"MAX\",\r\n    \"stepFunction\" : \"org.deeplearning4j.optimize.stepfunctions.DefaultStepFunction\"\r\n  } ],\r\n  \"useDropConnect\" : false,\r\n  \"useGaussNewtonVectorProductBackProp\" : false,\r\n  \"pretrain\" : true,\r\n  \"useRBMPropUpAsActivations\" : false,\r\n  \"dampingFactor\" : 100.0,\r\n  \"processors\" : { },\r\n  \"backward\" : false\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/deeplearning4j/deeplearning4j/issues/comments/98569373","html_url":"https://github.com/deeplearning4j/deeplearning4j/pull/234#issuecomment-98569373","issue_url":"https://api.github.com/repos/deeplearning4j/deeplearning4j/issues/234","id":98569373,"user":{"login":"EronWright","id":1775518,"avatar_url":"https://avatars.githubusercontent.com/u/1775518?v=3","gravatar_id":"","url":"https://api.github.com/users/EronWright","html_url":"https://github.com/EronWright","followers_url":"https://api.github.com/users/EronWright/followers","following_url":"https://api.github.com/users/EronWright/following{/other_user}","gists_url":"https://api.github.com/users/EronWright/gists{/gist_id}","starred_url":"https://api.github.com/users/EronWright/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EronWright/subscriptions","organizations_url":"https://api.github.com/users/EronWright/orgs","repos_url":"https://api.github.com/users/EronWright/repos","events_url":"https://api.github.com/users/EronWright/events{/privacy}","received_events_url":"https://api.github.com/users/EronWright/received_events","type":"User","site_admin":false},"created_at":"2015-05-04T02:30:04Z","updated_at":"2015-05-04T02:30:04Z","body":"I too am anxious for NeuralNetConfigurationTest to pass.   The equality check is failing at the stepfunction test ([#L594](https://github.com/deeplearning4j/deeplearning4j/blob/master/deeplearning4j-core/src/main/java/org/deeplearning4j/nn/conf/NeuralNetConfiguration.java#L594).   It probably hasn't passed since Dec/14.   I'll update the PR with a fix for stepfunction (similar to these other fixes)."}}