Created
December 17, 2015 02:28
-
-
Save LplusKira/6922e9456d3a74687134 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val conf: MultiLayerConfiguration = new NeuralNetConfiguration.Builder() | |
.regularization(true).l2(2e-6) | |
.seed(luckyseed) | |
.iterations(20) | |
.list(3) | |
... | |
.build(); | |
val iter: DataSetIterator = new GDataSetIteratorTrain(...) | |
while( iter.hasNext() ){ | |
val eachbatch: DataSet = iter.next() | |
model.fit(eachbatch) | |
} | |
val coefficient_bin = "coefficient.bin" | |
val conf_json = "conf.json" | |
val fos: OutputStream = Files.newOutputStream(Paths.get(coefficient_bin)) | |
val dos = new DataOutputStream(fos) | |
Nd4j.write(model.params(), dos) | |
dos.flush() | |
dos.close() | |
FileUtils.writeStringToFile(new File(conf_json), model.getLayerWiseConfigurations().toJson()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment