|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.encog.util.normalize.DataNormalization
public class DataNormalization
This class is used to normalize both input and ideal data for neural networks. This class can accept input from a variety of sources and output to a variety of targets. Normalization is a process by which input data is normalized so that it falls in specific ranges. Neural networks typically require input to be in the range of 0 to 1, or -1 to 1, depending on how the network is structured. The normalize class is typically given for different types of objects to tell it how to process data. Input Fields: Input fields specify the raw data that will be read by the Normalize class. Input fields are added to the Normalize class by calling addInputField method. Input fields must implement the InputField interface. There are a number of different input fields provided. Input data can be read from several different sources. For example, you can read the "neural network input" data from one CSV file and the "ideal neural network output" from another. Output Fields: The output fields are used to specify the final output from the Normalize class. The output fields specify both the "neural network input" and "ideal output". The output fields are flagged as either input our ideal. The output fields are not necessarily one-to-one with the input fields. For example, several input fields may combine to produce a single output field. Further some input fields may be used only to segregate data, whereas other input fields may be ignored all together. The type of output field that you specify determines the type of processing that will be done on that field. An OutputField is added by calling the addOutputField method. Segregators: Segregators are used generally for two related purposes. First, segregators can be used to exclude rows of data based on certain input values. Perhaps the data includes several classes of data, and you only want to train on one class. Secondly, segregators can be used to segregate data into training and evaluation sets. You may choose to use 80% of your data for training and 20% for evaluation. A segregator is added by calling the addSegregator method. Target Storage: The data created by the Normalization class must be stored somewhere. The storage targets allow this to be specified. The output can be sent to a CSV file, a NeuralDataSet, or any other target supported by a NormalizationStorage derived class. The target is specified by calling the setTarget method. The normalization process can take some time. The progress can be reported to a StatusReportable object. The normalization is a two pass process. The first pass counts the number of records and computes important statistics that will be used to normalize the output. The second pass actually performs the normalization and writes to the target. Both passes are performed when the process method is called.
Constructor Summary | |
---|---|
DataNormalization()
|
Method Summary | |
---|---|
void |
addInputField(InputField f)
Add an input field. |
void |
addOutputField(OutputField outputField)
Add an output field. |
void |
addOutputField(OutputField outputField,
boolean ideal)
Add a field and allow it to be specified as an "ideal output field". |
void |
addSegregator(Segregator segregator)
Add a segregator. |
MLData |
buildForNetworkInput(double[] data)
Build "input data for a neural network" based on the input values provided. |
InputField |
findInputField(Class<?> clazz,
int count)
Find an input field by its class. |
OutputField |
findOutputField(Class<?> clazz,
int count)
Find an output field by its class. |
CSVFormat |
getCSVFormat()
|
Set<OutputFieldGroup> |
getGroups()
|
List<InputField> |
getInputFields()
|
int |
getNetworkInputLayerSize()
|
int |
getNetworkOutputLayerSize()
|
int |
getOutputFieldCount()
|
List<OutputField> |
getOutputFields()
|
int |
getRecordCount()
|
StatusReportable |
getReport()
|
List<Segregator> |
getSegregators()
|
NormalizationStorage |
getStorage()
|
void |
init()
|
void |
initForOutput()
Setup the row for output. |
void |
initForPass()
Setup the row for output. |
void |
process()
Call this method to begin the normalization process. |
void |
setCSVFormat(CSVFormat csvFormat)
Set the CSV format to use. |
void |
setReport(StatusReportable report)
Set the object that this one is reporting to. |
void |
setTarget(NormalizationStorage target)
Determines where the normalized data will be sent. |
boolean |
twoPassesNeeded()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataNormalization()
Method Detail |
---|
public void addInputField(InputField f)
f
- The input field to add.public void addOutputField(OutputField outputField)
outputField
- The output field to add.public void addOutputField(OutputField outputField, boolean ideal)
outputField
- The output field.ideal
- True if this is an ideal field.public void addSegregator(Segregator segregator)
segregator
- The segregator to add.public MLData buildForNetworkInput(double[] data)
data
- The input values to be normalized.
public InputField findInputField(Class<?> clazz, int count)
clazz
- The input field class type you are looking for.count
- The instance of the input field needed, 0 for the first.
public OutputField findOutputField(Class<?> clazz, int count)
clazz
- The output field class type you are looking for.count
- The instance of the output field needed, 0 for the first.
public CSVFormat getCSVFormat()
public Set<OutputFieldGroup> getGroups()
public List<InputField> getInputFields()
public int getNetworkInputLayerSize()
public int getNetworkOutputLayerSize()
public int getOutputFieldCount()
public List<OutputField> getOutputFields()
public int getRecordCount()
public StatusReportable getReport()
public List<Segregator> getSegregators()
public NormalizationStorage getStorage()
public void initForOutput()
public void initForPass()
public void init()
public void process()
public void setCSVFormat(CSVFormat csvFormat)
csvFormat
- The CSV format to use.public void setReport(StatusReportable report)
report
- The object that progress reports should be sent to.public void setTarget(NormalizationStorage target)
target
- The target.public boolean twoPassesNeeded()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |