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.
- Alphabetic
- By Inheritance
- Perceptron
- Error
- Predictor
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
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
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
val
b: VectoD
- Attributes
- protected
- Definition Classes
- Predictor
-
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
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
coefficient: VectoD
Return the vector of coefficient/parameter values.
Return the vector of coefficient/parameter values.
- Definition Classes
- Predictor
-
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
-
val
e: VectoD
- Attributes
- protected
- Definition Classes
- Predictor
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
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
-
def
fitLabels: Seq[String]
Return the labels for the fit.
Return the labels for the fit. Override when necessary.
- Definition Classes
- Predictor
-
final
def
flaw(method: String, message: String): Unit
- Definition Classes
- Error
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
val
mae: Double
- Attributes
- protected
- Definition Classes
- Predictor
-
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
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
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
-
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
- Perceptron → Predictor
-
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
-
val
rSq: Double
- Attributes
- protected
- Definition Classes
- Predictor
-
def
reset(eta_: Double): Unit
Reset the leaning rate 'eta'.
-
def
residual: VectoD
Return the vector of residuals/errors.
Return the vector of residuals/errors.
- Definition Classes
- Predictor
-
val
rmse: Double
- Attributes
- protected
- Definition Classes
- Predictor
-
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
-
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
-
val
sse: Double
- Attributes
- protected
- Definition Classes
- Predictor
-
val
ssr: Double
- Attributes
- protected
- Definition Classes
- Predictor
-
val
sst: Double
- Attributes
- protected
- Definition Classes
- Predictor
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
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
- Perceptron → Predictor
-
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
- Perceptron → Predictor
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )