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
// From: "Character-Aware Neural Language Models" https://arxiv.org/abs/1508.06615 | |
val kernelsPerWidth = 5 | |
val numKernels = kernelWidths.length * kernelsPerWidth | |
val biasInterval = scala.util.Random.nextGaussian() / 0.5 | |
log.info("Build model....") | |
val confWithoutConv = new NeuralNetConfiguration.Builder() | |
.learningRate(0.01) |
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 kernelsPerWidth = 5 | |
val numKernels = kernelWidths.length * kernelsPerWidth | |
val biasInterval = scala.util.Random.nextGaussian() / 0.5 | |
log.info("Build model....") | |
val confWithoutConv = new NeuralNetConfiguration.Builder() | |
.learningRate(0.01) | |
.graphBuilder() | |
.addInputs("input") |
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
object Sunie { | |
def countFrom0to(num : Int, target : Int = 7) : Int = { | |
if(num < 10) { | |
if (num >= target) 1 else 0 | |
} | |
else { | |
val place = logb10(num) | |
val count = countFrom0to(num - (num / math.pow(10, logb10(num))).toInt * math.pow(10, logb10(num)).toInt, target) | |
val leadDig = num / math.pow(10, place).toInt | |
val targetFollowedByZeros = target * math.pow(10, place) |