org.encog.app.analyst.script.normalize
Class AnalystField
- java.lang.Object
-
- org.encog.app.analyst.script.normalize.AnalystField
-
public class AnalystField extends java.lang.ObjectHolds a field to be analyzed.
-
-
Field Summary
Fields Modifier and Type Field and Description static intMIN_EQ_CLASSESMinimum classes for encode using equilateral.
-
Constructor Summary
Constructors Constructor and Description AnalystField()Construct the object with a range of 1 and -1.AnalystField(AnalystField field)Construct an analyst field.AnalystField(double theNormalizedHigh, double theNormalizedLow)Construct the object.AnalystField(NormalizationAction theAction, java.lang.String theName)Construct an object.AnalystField(NormalizationAction theAction, java.lang.String theName, double ahigh, double alow, double nhigh, double nlow)Construct the field, with no defaults.AnalystField(java.lang.String theName, NormalizationAction theAction, double high, double low)Construct an analyst field to use.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddRawHeadings(java.lang.StringBuilder line, java.lang.String prefix, CSVFormat format)Add headings for a raw file.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.ClassItemdetermineClass(int pos, double[] data)Determine the class using part of an array.intdetermineMode(EncogAnalyst analyst)Determine the mode, this is the class item that has the most instances.double[]encode(double d)double[]encode(int classNumber)Encode the class.double[]encode(java.lang.String str)Encode the string to numeric form.double[]encodeEquilateral(int classNumber)Perform an equilateral encode.ClassItemfindClass(int index)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()intgetTimeSlice()voidinit()Init any internal structures.booleanisClassify()booleanisIgnored()booleanisInput()booleanisOutput()intlookup(java.lang.String str)Lookup the specified field.voidmakeClass(NormalizationAction theAction, int classFrom, int classTo, int high, int low)Make the classes based on numbers.voidmakeClass(NormalizationAction theAction, java.lang.String[] cls, double high, double low)Make the classes using names.voidmakePassThrough()Make this a pass-through field.doublenormalize(double value)Normalize the specified value.voidsetAction(NormalizationAction theAction)Set the theAction 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.voidsetOutput(boolean b)Set if this is an output field.voidsetTimeSlice(int theTimeSlice)java.lang.StringtoString()
-
-
-
Field Detail
-
MIN_EQ_CLASSES
public static final int MIN_EQ_CLASSES
Minimum classes for encode using equilateral.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AnalystField
public AnalystField()
Construct the object with a range of 1 and -1.
-
AnalystField
public AnalystField(AnalystField field)
Construct an analyst field. Works like a C++ copy constructor.- Parameters:
field- The field to clone.
-
AnalystField
public AnalystField(double theNormalizedHigh, double theNormalizedLow)Construct the object.- Parameters:
theNormalizedHigh- The normalized high.theNormalizedLow- The normalized low.
-
AnalystField
public AnalystField(NormalizationAction theAction, java.lang.String theName)
Construct an object.- Parameters:
theAction- The desired action.theName- The name of this column.
-
AnalystField
public AnalystField(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.
-
AnalystField
public AnalystField(java.lang.String theName, NormalizationAction theAction, double high, double low)Construct an analyst field to use.- Parameters:
theName- The name of the field.theAction- The action to use.high- The high value.low- The low value.
-
-
Method Detail
-
addRawHeadings
public void addRawHeadings(java.lang.StringBuilder line, java.lang.String prefix, CSVFormat format)Add headings for a raw file.- Parameters:
line- The line to write the raw headings to.prefix- The prefix to place.format- The format to use.
-
analyze
public 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 double deNormalize(double value)
Denormalize the specified value.- Parameters:
value- The value to normalize.- Returns:
- The normalized value.
-
determineClass
public 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.
-
determineClass
public ClassItem determineClass(int pos, double[] data)
Determine the class using part of an array.- Parameters:
pos- The position to begin.data- The array to check.- Returns:
- The class item.
-
encode
public double[] encode(int classNumber)
Encode the class.- Parameters:
classNumber- The class number.- Returns:
- The encoded class.
-
encode
public double[] encode(java.lang.String str)
Encode the string to numeric form.- Parameters:
str- The string to encode.- Returns:
- The numeric form.
-
encodeEquilateral
public double[] encodeEquilateral(int classNumber)
Perform an equilateral encode.- Parameters:
classNumber- The class number.- Returns:
- The class to encode.
-
fixSingleValue
public void fixSingleValue()
Fix normalized fields that have a single value for the min/max. Separate them by 2 units.
-
getAction
public NormalizationAction getAction()
- Returns:
- The action for the field.
-
getActualHigh
public double getActualHigh()
- Returns:
- The actual high for the field.
-
getActualLow
public double getActualLow()
- Returns:
- The actual low for the field.
-
getClasses
public java.util.List<ClassItem> getClasses()
- Returns:
- The classes.
-
getColumnsNeeded
public 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 Equilateral getEq()
- Returns:
- The equilateral utility.
-
getName
public java.lang.String getName()
- Returns:
- The name of the field.
-
getNormalizedHigh
public double getNormalizedHigh()
- Returns:
- The normalized high for the field.
-
getNormalizedLow
public double getNormalizedLow()
- Returns:
- The normalized low for the neural network.
-
getTimeSlice
public int getTimeSlice()
- Returns:
- the timeSlice
-
init
public void init()
Init any internal structures.
-
isClassify
public boolean isClassify()
- Returns:
- True if this field is classification.
-
isIgnored
public final boolean isIgnored()
- Returns:
- Is this field ignored.
-
isInput
public boolean isInput()
- Returns:
- Is this field input.
-
isOutput
public boolean isOutput()
- Returns:
- Is this field output.
-
lookup
public 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 void makeClass(NormalizationAction theAction, int classFrom, int classTo, int high, int low)
Make the classes based on numbers.- Parameters:
theAction- The action.classFrom- The starting class.classTo- The ending class.high- The high value.low- The low value.
-
makeClass
public void makeClass(NormalizationAction theAction, java.lang.String[] cls, double high, double low)
Make the classes using names.- Parameters:
theAction- The action to use.cls- The class names.high- The high value.low- The low value.
-
makePassThrough
public void makePassThrough()
Make this a pass-through field.
-
normalize
public double normalize(double value)
Normalize the specified value.- Parameters:
value- The value to normalize.- Returns:
- The normalized value.
-
setAction
public void setAction(NormalizationAction theAction)
Set the theAction for the field.- Parameters:
theAction- The action for the field.
-
setActualHigh
public void setActualHigh(double theActualHigh)
Set the actual high for the field.- Parameters:
theActualHigh- The actual high for the field.
-
setActualLow
public void setActualLow(double theActualLow)
Set the actual low for the field.- Parameters:
theActualLow- The actual low for the field.
-
setName
public void setName(java.lang.String theName)
Set the name of the field.- Parameters:
theName- The name of the field.
-
setNormalizedHigh
public void setNormalizedHigh(double theNormalizedHigh)
Set the normalized high for the field.- Parameters:
theNormalizedHigh- The normalized high for the field.
-
setNormalizedLow
public void setNormalizedLow(double theNormalizedLow)
Set the normalized low for the field.- Parameters:
theNormalizedLow- The normalized low for the field.
-
setOutput
public void setOutput(boolean b)
Set if this is an output field.- Parameters:
b- True, if this is output.
-
setTimeSlice
public void setTimeSlice(int theTimeSlice)
- Parameters:
theTimeSlice- the timeSlice to set
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
determineMode
public int determineMode(EncogAnalyst analyst)
Determine the mode, this is the class item that has the most instances.- Parameters:
analyst- The Encog analyst.- Returns:
- The mode.
-
encode
public double[] encode(double d)
-
findClass
public ClassItem findClass(int index)
-
-
DMelt 3.0 © DataMelt by jWork.ORG