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 m: Module = new Module() { | |
| val fc = Linear(100, 10) | |
| override def forward(x: Variable): Variable = x ~> fc ~> relu | |
| } |
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
| package org.apache.mxnet | |
| import java.util.concurrent.atomic.AtomicLong | |
| import com.typesafe.scalalogging.LazyLogging | |
| import scala.concurrent.{Await, Future} | |
| import scala.concurrent.duration._ | |
| import scala.language.postfixOps |
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
| package jtorch.cpu | |
| import java.util.concurrent.atomic.AtomicLong | |
| import com.typesafe.scalalogging.LazyLogging | |
| import scala.concurrent.{Await, Future} | |
| import scala.concurrent.duration._ | |
| import scala.language.postfixOps |
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
| package scorch.examples | |
| import botkop.numsca.Tensor | |
| import botkop.{numsca => ns} | |
| import scorch.autograd._ | |
| import scorch.nn.rnn.RecurrentModule | |
| import scorch.nn.Optimizer | |
| import scala.annotation.tailrec | |
| import scala.io.Source |
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
| package scorch | |
| import scorch.autograd._ | |
| import botkop.numsca.Tensor | |
| import botkop.{numsca => ns} | |
| import org.scalactic.{Equality, TolerantNumerics} | |
| import org.scalatest.{FlatSpec, Matchers} | |
| class AutoGradSpec extends FlatSpec with Matchers { | |
This file has been truncated, but you can view the full file.
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
| ap Love whof wamp m rove mak waizor in! shenven wor gpear I d selve for trave sp | |
| ---- | |
| iter 3326900, loss 40.139576923598945 | |
| ---- | |
| ouc | |
| O vow sppa'g nour love? | |
| FhCVaxt let ard tave wak! por uppit. onoum--prroudix. | |
| For tomn olip toor houk on trarid | |
| Are I! | |
| Wort deve wa?! |
This file has been truncated, but you can view the full file.
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
| ap Love whof wamp m rove mak waizor in! shenven wor gpear I d selve for trave sp | |
| ---- | |
| iter 3326900, loss 40.139576923598945 | |
| ---- | |
| ouc | |
| O vow sppa'g nour love? | |
| FhCVaxt let ard tave wak! por uppit. onoum--prroudix. | |
| For tomn olip toor houk on trarid | |
| Are I! | |
| Wort deve wa?! |
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
| case class SomeEvent(value: Long) | |
| val events = Source | |
| .tick(0 seconds, 250 millis, "") | |
| .zipWithIndex | |
| .map { case (_, l) => | |
| SomeEvent(l) | |
| } | |
| val group = Flow[SomeEvent].groupedWithin(100, 500 millis) // +/- 2 events per group |
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
| package botkop.nn.lecture3 | |
| import scala.language.postfixOps | |
| import scala.util.Random | |
| object SigmoidIterativeLearning extends App { | |
| case class LabeledData(numFish: Double, numChips: Double, numKetchup: Double, price: Double = 0.0) | |
| case class Weights(fish: Double, chips: Double, ketchup: Double) | |
| val trueWeights = Weights(0.150, 0.050, 0.100) |
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
| import scala.language.postfixOps | |
| import scala.util.Random | |
| object LinearIterativeLearning extends App { | |
| case class LabeledData(numFish: Int, numChips: Int, numKetchup: Int, price: Double = 0.0) | |
| case class Weights(fish: Double, chips: Double, ketchup: Double) |