org.encog.util.arrayutil
Class NormalizedField
- java.lang.Object
-
- org.encog.util.arrayutil.NormalizedField
-
- All Implemented Interfaces:
- java.io.Serializable
public class NormalizedField extends java.lang.Object implements java.io.SerializableThis 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
Constructors Constructor and Description NormalizedField()Construct the object with a range of 1 and -1.NormalizedField(double theNormalizedHigh, double theNormalizedLow)Construct the object.NormalizedField(NormalizationAction theAction, java.lang.String theName)Construct an object.NormalizedField(NormalizationAction theAction, java.lang.String theName, double ahigh, double alow, double nhigh, double nlow)Construct the field, with no defaults.NormalizedField(java.lang.String theName, NormalizationAction theAction, double high, double low)Construct the object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidanalyze(double d)Analyze the specified value.doubledeNormalize(double value)Denormalize the specified value.ClassItemdetermineClass(double[] data)Determine what class the specified data belongs to.java.lang.StringencodeHeaders()Encode the headers used by this field.java.lang.StringencodeSingleField(int classNumber)Encode a single field.voidfixSingleValue()Fix normalized fields that have a single value for the min/max.NormalizationActiongetAction()doublegetActualHigh()doublegetActualLow()java.util.List<ClassItem>getClasses()intgetColumnsNeeded()EquilateralgetEq()java.lang.StringgetName()doublegetNormalizedHigh()doublegetNormalizedLow()voidinit()Init any internal structures.booleanisClassify()intlookup(java.lang.String str)Lookup the specified field.voidmakeClass(NormalizationAction theAction, int classFrom, int classTo, int high, int low)Make a field to hold a class.voidmakeClass(NormalizationAction theAction, java.lang.String[] cls, double high, double low)Create a field that will be used to hold a class.voidmakePassThrough()Make this a pass-through field.doublenormalize(double value)Normalize the specified value.voidsetAction(NormalizationAction theAction)Set the action for the field.voidsetActualHigh(double theActualHigh)Set the actual high for the field.voidsetActualLow(double theActualLow)Set the actual low for the field.voidsetName(java.lang.String theName)Set the name of the field.voidsetNormalizedHigh(double theNormalizedHigh)Set the normalized high for the field.voidsetNormalizedLow(double theNormalizedLow)Set the normalized low for the field.java.lang.StringtoString()
-
-
-
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, java.lang.String theName)
Construct an object.- Parameters:
theAction- The desired action.theName- The name of this column.
-
NormalizedField
public NormalizedField(NormalizationAction theAction, java.lang.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(java.lang.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 java.lang.String encodeHeaders()
Encode the headers used by this field.- Returns:
- A string containing a comma separated list with the headers.
-
encodeSingleField
public final java.lang.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 java.util.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 java.lang.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(java.lang.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, java.lang.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(java.lang.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 java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG