Skip to content

Instantly share code, notes, and snippets.

View Mocuto's full-sized avatar

Tobi Akomolede AKA Mocuto Mocuto

View GitHub Profile
// 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)
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")
@Mocuto
Mocuto / Sunie.scala
Last active October 24, 2016 16:56
Mocuto's Awesome Solution to Sunie's Homework, in O(2^d - 1)) complexity
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)