Package

com.thoughtworks.deeplearning

plugins

Permalink

package plugins

Author:

杨博 (Yang Bo)

Source
package.scala
Linear Supertypes
AnyRef, Any
Content Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. plugins
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait Builtins extends ImplicitsSingleton with Layers with Weights with Logging with Operators with FloatTraining with FloatLiterals with FloatWeights with RawFloatLayers with FloatLayers with DoubleTraining with DoubleLiterals with DoubleWeights with RawDoubleLayers with DoubleLayers with INDArrayTraining with INDArrayLiterals with INDArrayWeights with RawINDArrayLayers with INDArrayLayers

    Permalink

    A plugin that enables all other DeepLearning.scala built-in plugins.

    A plugin that enables all other DeepLearning.scala built-in plugins.

    Author:

    杨博 (Yang Bo)

    Example:
    1. When creating a Builtins from Factory,

      import com.thoughtworks.feature.Factory
      val hyperparameters = Factory[plugins.Builtins].newInstance()

      and import anything in implicits,

      import hyperparameters.implicits._

      then all DeepLearning.scala built-in features should be enabled.


      Creating weights:

      import org.nd4j.linalg.factory.Nd4j
      import org.nd4j.linalg.api.ndarray.INDArray
      val numberOfInputFeatures = 8
      val numberOfOutputFeatures = 1
      val initialValueOfWeight: INDArray = Nd4j.rand(numberOfInputFeatures, numberOfOutputFeatures)
      val weight: hyperparameters.INDArrayWeight = hyperparameters.INDArrayWeight(initialValueOfWeight)

      Creating neural network layers,

      def fullyConnectedLayer(input: INDArray): hyperparameters.INDArrayLayer = {
        input dot weight
      }

      or loss functions:

      def hingeLoss(scores: hyperparameters.INDArrayLayer, label: INDArray): hyperparameters.DoubleLayer = {
        hyperparameters.max(0.0, 1.0 - label * scores).sum
      }

      Training:

      import scalaz.std.stream._
      import scalaz.concurrent.Task
      import com.thoughtworks.each.Monadic._
      val batchSize = 4
      val numberOfIterations = 10
      val input = Nd4j.rand(batchSize, numberOfInputFeatures)
      val label = Nd4j.rand(batchSize, numberOfOutputFeatures)
      @monadic[Task]
      def train: Task[Stream[Double]] = {
        for (iteration <- (0 until numberOfIterations).toStream) yield {
          hingeLoss(fullyConnectedLayer(input), label).train.each
        }
      }

      When the training is done, the loss of the last iteration should be no more than the loss of the first iteration

      train.map { lossesByIteration =>
        lossesByIteration.last should be <= lossesByIteration.head
      }
  2. trait DoubleLayers extends RawDoubleLayers

    Permalink

    Author:

    杨博 (Yang Bo)

    Example:
    1. xxx

      import com.thoughtworks.feature.Factory
      import com.thoughtworks.deeplearning.plugins._
      val hyperparameters = Factory[DoubleTraining with DoubleLayers with DoubleLiterals with ImplicitsSingleton with Operators].newInstance()
      import hyperparameters.implicits._
      val network: hyperparameters.DoubleLayer = (- (6.1f - (- DoubleLayerOps(3.4f))))
      network.predict
  3. trait DoubleLiterals extends AnyRef

    Permalink

    A plugin that enables scala.Double in neural networks.

  4. trait DoubleTraining extends Training

    Permalink

    A DeepLearning.scala plugin that enables train method for neural networks whose loss is a scala.Double.

    A DeepLearning.scala plugin that enables train method for neural networks whose loss is a scala.Double.

    Author:

    杨博 (Yang Bo)

  5. trait DoubleWeights extends Weights

    Permalink

    Author:

    杨博 (Yang Bo)

  6. trait FloatLayers extends RawFloatLayers

    Permalink

    Author:

    杨博 (Yang Bo)

    Example:
    1. xxx

      import com.thoughtworks.feature.Factory
      import com.thoughtworks.deeplearning.plugins._
      val hyperparameters = Factory[FloatTraining with FloatLayers with FloatLiterals with ImplicitsSingleton with Operators].newInstance()
      import hyperparameters.implicits._
      val network: hyperparameters.FloatLayer = (- (6.1f - (- FloatLayerOps(3.4f))))
      network.predict
  7. trait FloatLiterals extends AnyRef

    Permalink

    A plugin that enables scala.Float in neural networks.

  8. trait FloatTraining extends Training

    Permalink

    A DeepLearning.scala plugin that enables train method for neural networks whose loss is a scala.Float.

    A DeepLearning.scala plugin that enables train method for neural networks whose loss is a scala.Float.

    Author:

    杨博 (Yang Bo)

  9. trait FloatWeights extends Weights

    Permalink

    Author:

    杨博 (Yang Bo)

  10. trait INDArrayLayers extends RawINDArrayLayers

    Permalink

    Author:

    杨博 (Yang Bo)

  11. trait INDArrayLiterals extends AnyRef

    Permalink

    A plugin that enables org.nd4j.linalg.api.ndarray.INDArray in neural networks.

  12. trait INDArrayTraining extends Training

    Permalink

    A DeepLearning.scala plugin that enables train method for neural networks whose loss is a org.nd4j.linalg.api.ndarray.INDArray.

    A DeepLearning.scala plugin that enables train method for neural networks whose loss is a org.nd4j.linalg.api.ndarray.INDArray.

    Author:

    杨博 (Yang Bo)

  13. trait INDArrayWeights extends Weights with ImplicitsSingleton

    Permalink

    A plugin to create INDArray weight.

    A plugin to create INDArray weight.

    Author:

    杨博 (Yang Bo)

  14. trait ImplicitsSingleton extends AnyRef

    Permalink

    A plugin that creates the instance of implicits.

    A plugin that creates the instance of implicits.

    Any fields and methods in Implicits added by other plugins will be mixed-in and present in implicits.

  15. trait Layers extends AnyRef

    Permalink
  16. trait Logging extends Layers with Weights

    Permalink

    A plugin that logs uncaught exceptions raised from Layer and Weight.

    A plugin that logs uncaught exceptions raised from Layer and Weight.

    Author:

    杨博 (Yang Bo)

  17. trait Operators extends AnyRef

    Permalink

    A plugin of definitions of polymorphic operators.

    A plugin of definitions of polymorphic operators.

    Those functions are implemented in RawFloatLayers, RawDoubleLayers and RawINDArrayLayers.

    Author:

    杨博 (Yang Bo)

  18. trait RawDoubleLayers extends Layers

    Permalink

    Author:

    杨博 (Yang Bo)

    Example:
    1. xxx

      import com.thoughtworks.feature.Factory
      import com.thoughtworks.deeplearning.plugins._
      val hyperparameters = Factory[DoubleLiterals with DoubleTraining with RawDoubleLayers with ImplicitsSingleton].newInstance()
      import hyperparameters.implicits._
      val network = (- (- (- DoubleLayerOps(3.4f))))
      network.predict
  19. trait RawFloatLayers extends Layers

    Permalink

    Author:

    杨博 (Yang Bo)

    Example:
    1. xxx

      import com.thoughtworks.feature.Factory
      import com.thoughtworks.deeplearning.plugins._
      val hyperparameters = Factory[FloatLiterals with FloatTraining with RawFloatLayers with ImplicitsSingleton].newInstance()
      import hyperparameters.implicits._
      val network = (- (- (- FloatLayerOps(3.4f))))
      network.predict
  20. trait RawINDArrayLayers extends RawDoubleLayers with DoubleLiterals with ImplicitsSingleton

    Permalink

    Author:

    杨博 (Yang Bo)

  21. trait Training extends AnyRef

    Permalink

    A DeepLearning.scala plugin that enables methods defined in DeepLearning.Ops for neural networks.

    A DeepLearning.scala plugin that enables methods defined in DeepLearning.Ops for neural networks.

    Author:

    杨博 (Yang Bo)

  22. trait Weights extends AnyRef

    Permalink

    Author:

    杨博 (Yang Bo)

Value Members

  1. object Logging

    Permalink
  2. object Operators

    Permalink
  3. object RawINDArrayLayers

    Permalink

Inherited from AnyRef

Inherited from Any

Ungrouped