org.encog.util.arrayutil
Class NormalizedField

java.lang.Object
  extended by org.encog.util.arrayutil.NormalizedField
All Implemented Interfaces:
Serializable

public class NormalizedField
extends Object
implements Serializable

This object holds the normalization stats for a column. This includes the actual and desired high-low range for this column.

See Also:
Serialized Form

Constructor Summary
NormalizedField()
          Construct the object with a range of 1 and -1.
NormalizedField(double theNormalizedHigh, double theNormalizedLow)
          Construct the object.
NormalizedField(NormalizationAction theAction, String theName)
          Construct an object.
NormalizedField(NormalizationAction theAction, String theName, double ahigh, double alow, double nhigh, double nlow)
          Construct the field, with no defaults.
NormalizedField(String theName, NormalizationAction theAction, double high, double low)
          Construct the object.
 
Method Summary
 void analyze(double d)
          Analyze the specified value.
 double deNormalize(double value)
          Denormalize the specified value.
 ClassItem determineClass(double[] data)
          Determine what class the specified data belongs to.
 String encodeHeaders()
          Encode the headers used by this field.
 String encodeSingleField(int classNumber)
          Encode a single field.
 void fixSingleValue()
          Fix normalized fields that have a single value for the min/max.
 NormalizationAction getAction()
           
 double getActualHigh()
           
 double getActualLow()
           
 List<ClassItem> getClasses()
           
 int getColumnsNeeded()
           
 Equilateral getEq()
           
 String getName()
           
 double getNormalizedHigh()
           
 double getNormalizedLow()
           
 void init()
          Init any internal structures.
 boolean isClassify()
           
 int lookup(String str)
          Lookup the specified field.
 void makeClass(NormalizationAction theAction, int classFrom, int classTo, int high, int low)
          Make a field to hold a class.
 void makeClass(NormalizationAction theAction, String[] cls, double high, double low)
          Create a field that will be used to hold a class.
 void makePassThrough()
          Make this a pass-through field.
 double normalize(double value)
          Normalize the specified value.
 void setAction(NormalizationAction theAction)
          Set the action for the field.
 void setActualHigh(double theActualHigh)
          Set the actual high for the field.
 void setActualLow(double theActualLow)
          Set the actual low for the field.
 void setName(String theName)
          Set the name of the field.
 void setNormalizedHigh(double theNormalizedHigh)
          Set the normalized high for the field.
 void setNormalizedLow(double theNormalizedLow)
          Set the normalized low for the field.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NormalizedField

public NormalizedField()
Construct the object with a range of 1 and -1.


NormalizedField

public NormalizedField(double theNormalizedHigh,
                       double theNormalizedLow)
Construct the object.

Parameters:
theNormalizedHigh - The normalized high.
theNormalizedLow - The normalized low.

NormalizedField

public NormalizedField(NormalizationAction theAction,
                       String theName)
Construct an object.

Parameters:
theAction - The desired action.
theName - The name of this column.

NormalizedField

public NormalizedField(NormalizationAction theAction,
                       String theName,
                       double ahigh,
                       double alow,
                       double nhigh,
                       double nlow)
Construct the field, with no defaults.

Parameters:
theAction - The normalization action to take.
theName - The name of this field.
ahigh - The actual high.
alow - The actual low.
nhigh - The normalized high.
nlow - The normalized low.

NormalizedField

public NormalizedField(String theName,
                       NormalizationAction theAction,
                       double high,
                       double low)
Construct the object.

Parameters:
theName - The name of the field.
theAction - The action of the field.
high - The high end of the range for the field.
low - The low end of the range for the field.
Method Detail

analyze

public final void analyze(double d)
Analyze the specified value. Adjust min/max as needed. Usually used only internally.

Parameters:
d - The value to analyze.

deNormalize

public final double deNormalize(double value)
Denormalize the specified value.

Parameters:
value - The value to normalize.
Returns:
The normalized value.

determineClass

public final ClassItem determineClass(double[] data)
Determine what class the specified data belongs to.

Parameters:
data - The data to analyze.
Returns:
The class the data belongs to.

encodeHeaders

public final String encodeHeaders()
Encode the headers used by this field.

Returns:
A string containing a comma separated list with the headers.

encodeSingleField

public final String encodeSingleField(int classNumber)
Encode a single field.

Parameters:
classNumber - The class number to encode.
Returns:
The encoded columns.

fixSingleValue

public final void fixSingleValue()
Fix normalized fields that have a single value for the min/max. Separate them by 2 units.


getAction

public final NormalizationAction getAction()
Returns:
The action for the field.

getActualHigh

public final double getActualHigh()
Returns:
The actual high for the field.

getActualLow

public final double getActualLow()
Returns:
The actual low for the field.

getClasses

public final List<ClassItem> getClasses()
Returns:
A list of any classes in this field.

getColumnsNeeded

public final int getColumnsNeeded()
Returns:
Returns the number of columns needed for this classification. The number of columns needed will vary, depending on the classification method used.

getEq

public final Equilateral getEq()
Returns:
The equilateral object used by this class, null if none.

getName

public final String getName()
Returns:
The name of the field.

getNormalizedHigh

public final double getNormalizedHigh()
Returns:
The normalized high for the field.

getNormalizedLow

public final double getNormalizedLow()
Returns:
The normalized low for the neural network.

init

public final void init()
Init any internal structures.


isClassify

public final boolean isClassify()
Returns:
Is this field a classify field.

lookup

public final int lookup(String str)
Lookup the specified field.

Parameters:
str - The name of the field to lookup.
Returns:
The index of the field, or -1 if not found.

makeClass

public final void makeClass(NormalizationAction theAction,
                            int classFrom,
                            int classTo,
                            int high,
                            int low)
Make a field to hold a class. Use a numeric range for class items.

Parameters:
theAction - The action to take.
classFrom - The beginning class item.
classTo - The ending class item.
high - The output high value.
low - The output low value.

makeClass

public final void makeClass(NormalizationAction theAction,
                            String[] cls,
                            double high,
                            double low)
Create a field that will be used to hold a class.

Parameters:
theAction - The action for this field.
cls - The class items.
high - The output high value.
low - The output low value.

makePassThrough

public final void makePassThrough()
Make this a pass-through field.


normalize

public final double normalize(double value)
Normalize the specified value.

Parameters:
value - The value to normalize.
Returns:
The normalized value.

setAction

public final void setAction(NormalizationAction theAction)
Set the action for the field.

Parameters:
theAction - The action for the field.

setActualHigh

public final void setActualHigh(double theActualHigh)
Set the actual high for the field.

Parameters:
theActualHigh - The actual high for the field.

setActualLow

public final void setActualLow(double theActualLow)
Set the actual low for the field.

Parameters:
theActualLow - The theActual low for the field.

setName

public final void setName(String theName)
Set the name of the field.

Parameters:
theName - The name of the field.

setNormalizedHigh

public final void setNormalizedHigh(double theNormalizedHigh)
Set the normalized high for the field.

Parameters:
theNormalizedHigh - The normalized high for the field.

setNormalizedLow

public final void setNormalizedLow(double theNormalizedLow)
Set the normalized low for the field.

Parameters:
theNormalizedLow - The normalized low for the field.

toString

public final String toString()

Overrides:
toString in class Object


Copyright © 2014. All Rights Reserved.