public class PatternSet extends java.lang.Object implements Storable, java.lang.Cloneable
This class provides access to the lists and methods to load and store the DataSet to/from XML.
| Modifier and Type | Field and Description |
|---|---|
protected IOFilter |
filter
The data IO filter (default Boone).
|
protected java.util.List<java.util.List<java.lang.Double>> |
inputs
The input patterns.
|
protected java.util.ArrayList<java.lang.String> |
names
The optional pattern names ordered accordingly.
|
protected java.util.List<java.util.List<java.lang.Double>> |
outputs
The output patterns.
|
protected java.util.Properties |
props
Arbitrary properties to be stored along with data sets.
|
protected java.util.List<java.util.List<java.lang.Double>> |
targets
The target patterns.
|
| Constructor and Description |
|---|
PatternSet()
Creates an empty DataSet with the default Boone IO filter with compression.
|
PatternSet(IOFilter filter)
Creates an empty dataset with the given IO filter.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
addInput(java.util.List<java.lang.Double> feature)
Adds an input feature value for all patterns.
|
PatternSet |
clone()
Creates a (nearly) deep copy of this data set.
|
void |
fromXML(org.jdom2.Element element)
Reads patterns from XML tree.
|
IOFilter |
getFilter()
Returns the IO filter.
|
java.util.List<java.lang.Double> |
getInput(int index)
Returns the input feature values of the given feature for all patterns.
|
int |
getInputPatternSize()
Return the number of values for each input pattern.
|
java.util.List<java.util.List<java.lang.Double>> |
getInputs()
Get the list that holds the network input-related data.
|
java.util.ArrayList<java.lang.String> |
getNames()
Returns the pattern names.
|
int |
getNextElement()
Returns the index of the next pattern.
|
java.util.List<java.lang.Double> |
getOutput(int index)
Returns the output values of the given output for all patterns.
|
int |
getOutputPatternSize()
Return the number of values for each output pattern.
|
java.util.List<java.util.List<java.lang.Double>> |
getOutputs()
Get the list that holds the network output-related data.
|
java.util.Properties |
getProperties()
Get the properties to be stored along with this data set.
|
java.util.List<java.lang.Double> |
getTarget(int index)
Returns the target values of the given target for all patterns.
|
java.lang.String |
getTargetLabel(int value)
Returns the name of the given target value.
|
int |
getTargetLabelCount()
Returns the number of targets with a name.
|
java.lang.String |
getTargetLabelOfPattern(int index)
Returns the target label of the given pattern.
|
int |
getTargetPatternSize()
Return the number of values for each target pattern.
|
java.util.List<java.util.List<java.lang.Double>> |
getTargets()
Get the list that holds the network training-related data.
|
boolean |
hasMoreElements()
Indicates, if there are more patterns in the set.
|
PatternSet |
load(java.io.File file)
Loads data from the given file using the set file filter.
|
PatternSet |
load(IOFilter filter)
Loads data using the given file filter.
|
void |
save(java.io.File file)
Save the data set to the given file.
|
void |
save(IOFilter filter)
Saves the pattern set to the given filter.
|
void |
setFilter(IOFilter filter)
Sets the IO filter.
|
void |
setInputs(java.util.List<java.util.List<java.lang.Double>> inputs)
Sets the network inputs.
|
void |
setProperties(java.util.Properties props)
Set the properties to be stored along with this data set.
|
void |
setTargetLabel(int value,
java.lang.String label)
Sets the label for the given target value.
|
void |
setTargets(java.util.List<java.util.List<java.lang.Double>> targets)
Sets the network targets.
|
void |
shuffle()
Reorders the patterns in this set randomly.
|
int |
size()
Return the size of the pattern set, which is the number of input patterns.
|
java.lang.String |
toString()
Returns a string representation of this pattern set.
|
org.jdom2.Element |
toXML(org.jdom2.Element element)
Writes patterns to XML tree.
|
java.lang.StringBuffer |
writeValues(char separator,
boolean names,
boolean split)
Writes a pattern set into a string buffer.
|
protected java.util.ArrayList<java.lang.String> names
protected java.util.List<java.util.List<java.lang.Double>> inputs
protected java.util.List<java.util.List<java.lang.Double>> targets
protected java.util.List<java.util.List<java.lang.Double>> outputs
protected java.util.Properties props
protected IOFilter filter
public PatternSet()
public PatternSet(IOFilter filter)
filter - an IO filterpublic PatternSet clone() throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedException - indicates clone problems, should not happenpublic boolean hasMoreElements()
public int getNextElement()
public java.util.ArrayList<java.lang.String> getNames()
public java.util.List<java.util.List<java.lang.Double>> getInputs()
public void setInputs(java.util.List<java.util.List<java.lang.Double>> inputs)
inputs - the input patternspublic java.util.List<java.lang.Double> getInput(int index)
index - the feature indexpublic boolean addInput(java.util.List<java.lang.Double> feature)
feature - a list of feature valuespublic java.util.List<java.util.List<java.lang.Double>> getTargets()
public void setTargets(java.util.List<java.util.List<java.lang.Double>> targets)
targets - the desired ouptput patternspublic java.util.List<java.lang.Double> getTarget(int index)
index - the target indexpublic java.util.List<java.util.List<java.lang.Double>> getOutputs()
public java.util.List<java.lang.Double> getOutput(int index)
index - the output indexpublic java.util.Properties getProperties()
public void setProperties(java.util.Properties props)
props - a property object holding the propertiespublic IOFilter getFilter()
public void setFilter(IOFilter filter)
filter - an IO filterpublic int size()
public int getInputPatternSize()
public int getTargetPatternSize()
public int getOutputPatternSize()
public PatternSet load(java.io.File file) throws java.io.IOException
file - file to load the data fromjava.io.IOException - reading problempublic PatternSet load(IOFilter filter) throws java.io.IOException
filter - filter to load the data withjava.io.IOException - reading problempublic void save(java.io.File file)
throws java.io.IOException
java.io.IOException - writing problempublic void save(IOFilter filter) throws java.io.IOException
filter - the filter with the file to be writtenjava.io.IOException - writing problempublic void shuffle()
public void fromXML(org.jdom2.Element element)
public org.jdom2.Element toXML(org.jdom2.Element element)
public java.lang.StringBuffer writeValues(char separator,
boolean names,
boolean split)
separator - the character separating valuesnames - if true, pattern names are added as single line comments (starting with '#')split - if true, input values and target values appear on separate linespublic int getTargetLabelCount()
public java.lang.String getTargetLabel(int value)
value - the target valuepublic void setTargetLabel(int value,
java.lang.String label)
value - the target valuelabel - the label for the targetpublic java.lang.String getTargetLabelOfPattern(int index)
index - the pattern indexpublic java.lang.String toString()
toString in class java.lang.Object