org.joone.util
Class ToBinaryPlugin

java.lang.Object
  extended by org.joone.util.AbstractConverterPlugIn
      extended by org.joone.util.ConverterPlugIn
          extended by org.joone.util.ToBinaryPlugin
All Implemented Interfaces:
java.io.Serializable, PlugInListener

public class ToBinaryPlugin
extends ConverterPlugIn

This plug-in converts 10-base data to binary format. The plug-in ingnores the broken part (the part after the . ) for non-integer numbers. It works correct for positive as well as for negative numbers.

Author:
Boris Jansen
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.joone.util.AbstractConverterPlugIn
pluginListeners
 
Constructor Summary
ToBinaryPlugin()
          Creates a new instance of ToBinaryPlugin
ToBinaryPlugin(java.lang.String anAdvancedSerieSelector)
          Creates a new instance of ToBinaryPlugin
 
Method Summary
protected  boolean apply()
          Applies all the conversions on the patterns contained by AbstractConverterPlugIn.InputVector
protected  boolean convert(int serie)
          Applies the conversion on the Nth serie of the buffered pattern data.
protected  double[] getBinary(double aNumber)
          Converts a number to a binary number (the part after the .
 double getLowerBit()
          Gets the value used for the lower bit.
 double getUpperBit()
          Gets the value used for the upper bit.
 void setLowerBit(double aValue)
          Sets the value for the lower bit.
 void setUpperBit(double aValue)
          Sets the value for the upper bit.
 
Methods inherited from class org.joone.util.ConverterPlugIn
isApplyEveryCycle, newCycle, setApplyEveryCycle
 
Methods inherited from class org.joone.util.AbstractConverterPlugIn
addPlugIn, addPlugInListener, applyOnColumns, applyOnRows, cascade, check, convertPatterns, dataChanged, fireDataChanged, getAdvancedSerieSelector, getInputVector, getName, getNextPlugIn, getPluginListeners, getSerieIndexNumber, getSerieSelected, getValuePoint, isConnected, removeAllPlugIns, removePlugInListener, setAdvancedSerieSelector, setConnected, setInputVector, setName, setNextPlugin, setNextPlugIn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToBinaryPlugin

public ToBinaryPlugin()
Creates a new instance of ToBinaryPlugin


ToBinaryPlugin

public ToBinaryPlugin(java.lang.String anAdvancedSerieSelector)
Creates a new instance of ToBinaryPlugin

Parameters:
anAdvancedSerieSelector - the advanced serie selector to use.
See Also:
setAdvancedSerieSelector()
Method Detail

convert

protected boolean convert(int serie)
Description copied from class: AbstractConverterPlugIn
Applies the conversion on the Nth serie of the buffered pattern data. The method is abstract and should be overridden by the implementing class. Implementing classes can obtain the input patterns by calling the AbstractConverterPlugIn.getInputVector() method. The result is a Vector of Pattern objects which this method should use by converting the requested serie.

Specified by:
convert in class AbstractConverterPlugIn
Parameters:
serie - the serie to convert

apply

protected boolean apply()
Description copied from class: AbstractConverterPlugIn
Applies all the conversions on the patterns contained by AbstractConverterPlugIn.InputVector

Overrides:
apply in class AbstractConverterPlugIn
Returns:
true if the input buffer is changed

getBinary

protected double[] getBinary(double aNumber)
Converts a number to a binary number (the part after the . (like 348 in 321.348) is ignored).

Parameters:
aNumber - the number to convert.
Returns:
the converted number as an array in binary form.

setUpperBit

public void setUpperBit(double aValue)
Sets the value for the upper bit. In binary problems it is often better to use 0.3 and 0.7 or -0.7 and 0.7 as target instead of 0 and 1 or -1 and 1, because the asymptotes (0 and 1) tend to take a long time to train, worsen generalization and drive the weights to very large values. By using this function you can set a different value for the upper bit.

Parameters:
aValue - the value to use for the upper bit.

getUpperBit

public double getUpperBit()
Gets the value used for the upper bit.


setLowerBit

public void setLowerBit(double aValue)
Sets the value for the lower bit.

Parameters:
aValue - the value to use for the lower bit.

getLowerBit

public double getLowerBit()
Gets the value used for the lower bit.



Submit Feedback to pmarrone@users.sourceforge.net