|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--lnsc.AbstractFunctionalUnit | +--lnsc.AbstractSimpleUnit
Abstract class containing the basic implementation for simple
univariate single-real-valued FunctionalUnit
. These functions
will have the form f'(x) = factor*f(x) + offset
where
f(x)
needs to be implemented.
This class encapsulates all the methods and slots required to create a
functional unit of 1 input and 1 output from the class
AbstractFunctionUnit
. It is the fastest way to create such
units. Only 3 simple things are needed by subclasses:
m_IsDifferentiable
must
be filled appropriately. (m_IsStateless
is assumed
true
)function(double)
, and
functionDerivative(double)
if the function is
differentiable, need to be implemented.
FunctionalUnit
are Serializable
and
Cloneable
, any required extra code to make these
interfaces work properly should be added. It is necessary to at
least set the private static serialVersionUID
variable
appropriately for the Seriablizable
interface. For
complex object, the Cloneable
interface can rely on
Tools.copyObject(Serializable)
. Moreover, every function derived from AbstractSimpleUnit
can
also be re-scaled and offset to match any specific output range. The output
computed by the original function(double)
can be multiplied by
factor
and then translated by adding offset
. The
functionDerivative(double)
is adjusted accordingly. By default
factor = 1.0
and offset = 0.0
.
Nested Class Summary |
Nested classes inherited from class lnsc.FunctionalUnit |
FunctionalUnit.ProcessPatternResult |
Field Summary |
Fields inherited from interface lnsc.FunctionalUnit |
EMPTY_PATTERN |
Constructor Summary | |
AbstractSimpleUnit()
Creates a simple unit with Factor=1.0 and Offset=0.0. |
|
AbstractSimpleUnit(double newFactor,
double newOffset)
Creates a simple unit with given factor and offset. |
Method Summary | |
double |
getFactor()
Returns the scaling factor applied to the internal output. |
double |
getOffset()
Returns the value added to the scaled output. |
FunctionalUnit.ProcessPatternResult |
processPattern(double[] inputPattern,
boolean computeDerivative,
boolean computeSecondDerivative)
Processes an input pattern and returns its output pattern and derivative (if requested). |
void |
setFactor(double newFactor)
Sets the factor applied to the internal output. |
void |
setOffset(double newOffset)
Sets the value added to the scaled output. |
java.lang.String |
toString()
|
Methods inherited from class lnsc.AbstractFunctionalUnit |
clone, getInputCount, getOutputCount, isDifferentiable, isStateless, isTwiceDifferentiable, processDataSet, reset |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public AbstractSimpleUnit()
public AbstractSimpleUnit(double newFactor, double newOffset)
newFactor
- Function factor.newOffset
- Function offset.Method Detail |
public final double getFactor()
public final double getOffset()
public final FunctionalUnit.ProcessPatternResult processPattern(double[] inputPattern, boolean computeDerivative, boolean computeSecondDerivative)
FunctionalUnit
processPattern
in interface FunctionalUnit
processPattern
in class AbstractFunctionalUnit
public final void setFactor(double newFactor)
newFactor
- Factor applied to the internal
output.public final void setOffset(double newOffset)
newOffset
- Value added to the scaled output.public java.lang.String toString()
toString
in class AbstractFunctionalUnit
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |