org.encog.app.analyst.script.normalize
Class AnalystField

java.lang.Object
  extended by org.encog.app.analyst.script.normalize.AnalystField

public class AnalystField
extends Object

Holds a field to be analyzed.


Field Summary
static int MIN_EQ_CLASSES
          Minimum classes for encode using equilateral.
 
Constructor Summary
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, String theName)
          Construct an object.
AnalystField(NormalizationAction theAction, String theName, double ahigh, double alow, double nhigh, double nlow)
          Construct the field, with no defaults.
AnalystField(String theName, NormalizationAction theAction, double high, double low)
          Construct an analyst field to use.
 
Method Summary
 void addRawHeadings(StringBuilder line, String prefix, CSVFormat format)
          Add headings for a raw file.
 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.
 ClassItem determineClass(int pos, double[] data)
          Determine the class using part of an array.
 double[] encode(int classNumber)
          Encode the class.
 double[] encode(String str)
          Encode the string to numeric form.
 double[] encodeEquilateral(int classNumber)
          Perform an equilateral encode.
 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()
           
 int getTimeSlice()
           
 void init()
          Init any internal structures.
 boolean isClassify()
           
 boolean isIgnored()
           
 boolean isInput()
           
 boolean isOutput()
           
 int lookup(String str)
          Lookup the specified field.
 void makeClass(NormalizationAction theAction, int classFrom, int classTo, int high, int low)
          Make the classes based on numbers.
 void makeClass(NormalizationAction theAction, String[] cls, double high, double low)
          Make the classes using names.
 void makePassThrough()
          Make this a pass-through field.
 double normalize(double value)
          Normalize the specified value.
 void setAction(NormalizationAction theAction)
          Set the theAction 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.
 void setOutput(boolean b)
          Set if this is an output field.
 void setTimeSlice(int theTimeSlice)
           
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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,
                    String theName)
Construct an object.

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

AnalystField

public AnalystField(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.

AnalystField

public AnalystField(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 final void addRawHeadings(StringBuilder line,
                                 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 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.

determineClass

public final 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 final double[] encode(int classNumber)
Encode the class.

Parameters:
classNumber - The class number.
Returns:
The encoded class.

encode

public final double[] encode(String str)
Encode the string to numeric form.

Parameters:
str - The string to encode.
Returns:
The numeric form.

encodeEquilateral

public final double[] encodeEquilateral(int classNumber)
Perform an equilateral encode.

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

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:
The classes.

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 utility.

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.

getTimeSlice

public final int getTimeSlice()
Returns:
the timeSlice

init

public final void init()
Init any internal structures.


isClassify

public final boolean isClassify()
Returns:
True if this field is classification.

isIgnored

public final boolean isIgnored()
Returns:
Is this field ignored.

isInput

public final boolean isInput()
Returns:
Is this field input.

isOutput

public final boolean isOutput()
Returns:
Is this field output.

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 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 final void makeClass(NormalizationAction theAction,
                            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 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 theAction 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 actual 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.

setOutput

public final void setOutput(boolean b)
Set if this is an output field.

Parameters:
b - True, if this is output.

setTimeSlice

public final void setTimeSlice(int theTimeSlice)
Parameters:
theTimeSlice - the timeSlice to set

toString

public final String toString()

Overrides:
toString in class Object


Copyright © 2011. All Rights Reserved.