Packages

class Perceptron extends Predictor with Error

The Perceptron class supports single-output, 2-layer (input and output) Neural-Networks. Although perceptrons are typically used for classification, this class is used for prediction. Given several input vectors and output values (training data), fit the weights/parameters 'b' connecting the layers, so that for a new input vector 'z', the net can predict the output value, i.e.,

z = f (b dot z)

The parameter vector 'b' (w) gives the weights between input and output layers. Note, b0 is treated as the bias, so x0 must be 1.0.

Linear Supertypes
Error, Predictor, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Perceptron
  2. Error
  3. Predictor
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Perceptron(x: MatrixD, y: VectorD, eta: Double = 1.0, afunc: FunctionS2S = sigmoid, afuncV: FunctionV_2V = sigmoidV)

    x

    the input matrix (training data consisting of m input vectors)

    y

    the output vector (training data consisting of m output values)

    eta

    the learning/convergence rate (typically less than 1.0)

    afunc

    the activation function (mapping scalar => scalar)

    afuncV

    the activation function (mapping vector => vector)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. val b: VectoD
    Attributes
    protected
    Definition Classes
    Predictor
  6. def check(yy: VectoD): Unit

    Given training data 'x' and 'yy', fit the parameter/weight vector 'b'.

    Given training data 'x' and 'yy', fit the parameter/weight vector 'b'.

    yy

    the output vector

  7. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def coefficient: VectoD

    Return the vector of coefficient/parameter values.

    Return the vector of coefficient/parameter values.

    Definition Classes
    Predictor
  9. def diagnose(yy: VectoD): Unit

    Compute diagostics for the predictor.

    Compute diagostics for the predictor. Override to add more diagostics. Note, for 'rmse', 'sse' is divided by the number of instances 'm' rather than degrees of freedom.

    yy

    the response vector

    Definition Classes
    Predictor
    See also

    en.wikipedia.org/wiki/Mean_squared_error

  10. val e: VectoD
    Attributes
    protected
    Definition Classes
    Predictor
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. def fit: VectoD

    Return the quality of fit including 'sse', 'mae', rmse' and 'rSq'.

    Return the quality of fit including 'sse', 'mae', rmse' and 'rSq'. Override to add more quality of fit measures.

    Definition Classes
    Predictor
  15. def fitLabels: Seq[String]

    Return the labels for the fit.

    Return the labels for the fit. Override when necessary.

    Definition Classes
    Predictor
  16. final def flaw(method: String, message: String): Unit
    Definition Classes
    Error
  17. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  18. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. val mae: Double
    Attributes
    protected
    Definition Classes
    Predictor
  21. def minimizeError(yy: VectoD): Unit

    Minimize the error in the prediction by adjusting the weight vector 'b'.

    Minimize the error in the prediction by adjusting the weight vector 'b'. The error 'e' is simply the difference between the target value 'yy' and the predicted value 'yp'. Minimize 1/2 of the dot product of error with itself using gradient-descent. The gradient is '-x.t * (e * yp * (_1 - yp))', so move in the opposite direction of the gradient.

    yy

    the output vector

  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. final def notify(): Unit
    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  25. def predict(z: MatriD): VectoD

    Given a new input vector 'z', predict the output/response value 'f(z)'.

    Given a new input vector 'z', predict the output/response value 'f(z)'.

    z

    the new input vector

  26. def predict(z: VectoD): Double

    Given a new input vector 'z', predict the output/response value 'f(z)'.

    Given a new input vector 'z', predict the output/response value 'f(z)'.

    z

    the new input vector

    Definition Classes
    PerceptronPredictor
  27. def predict(z: VectoI): Double

    Given a new discrete data vector z, predict the y-value of f(z).

    Given a new discrete data vector z, predict the y-value of f(z).

    z

    the vector to use for prediction

    Definition Classes
    Predictor
  28. val rSq: Double
    Attributes
    protected
    Definition Classes
    Predictor
  29. def reset(eta_: Double): Unit

    Reset the leaning rate 'eta'.

  30. def residual: VectoD

    Return the vector of residuals/errors.

    Return the vector of residuals/errors.

    Definition Classes
    Predictor
  31. val rmse: Double
    Attributes
    protected
    Definition Classes
    Predictor
  32. def setWeights(stream: Int = 0): Unit

    Set the initial weight vector 'b' with values in (0, 1) before training.

    Set the initial weight vector 'b' with values in (0, 1) before training.

    stream

    the random number stream to use

  33. def setWeights(w0: VectorD): Unit

    Set the initial weight vector 'b' manually before training.

    Set the initial weight vector 'b' manually before training.

    w0

    the initial weights for b

  34. val sse: Double
    Attributes
    protected
    Definition Classes
    Predictor
  35. val ssr: Double
    Attributes
    protected
    Definition Classes
    Predictor
  36. val sst: Double
    Attributes
    protected
    Definition Classes
    Predictor
  37. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  38. def toString(): String
    Definition Classes
    AnyRef → Any
  39. def train(): Unit

    Given training data 'x' and 'y', fit the parameter/weight vector 'b'.

    Given training data 'x' and 'y', fit the parameter/weight vector 'b'.

    Definition Classes
    PerceptronPredictor
  40. def train(yy: VectoD): Unit

    Given training data 'x' and 'yy', fit the parameter/weight vector 'b'.

    Given training data 'x' and 'yy', fit the parameter/weight vector 'b'.

    yy

    the output vector

    Definition Classes
    PerceptronPredictor
  41. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Error

Inherited from Predictor

Inherited from AnyRef

Inherited from Any

Ungrouped