|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdatabionics.esom.train.SOM
public abstract class SOM
Abstract base class for a self organizing map training algorithm. It is a container for
Field Summary | |
---|---|
protected cern.colt.list.IntArrayList |
bestmatches
indices of best matching neurons for data points |
protected BmSearch |
bmSearch
the search system |
protected BmSearchStat |
bmStat
the bm search statistic |
protected boolean |
bmStatNeeded
|
protected boolean |
center
flag for centering the map |
protected ClsFile |
classes
|
protected cern.colt.list.IntArrayList |
count
|
cern.colt.matrix.DoubleMatrix2D |
data
matrix with training data |
protected Descriptives |
descriptives
statistics about data |
protected cern.colt.function.ThresholdVectorVectorFunction |
distanceFunction
distance function in data space |
protected cern.colt.matrix.DoubleMatrix1D |
distances
current distances between bestmatches and datapoints |
protected int |
epoch
current epoch number 0..epochs-1, only used internally |
protected int |
epochs
number of training epochs |
protected Grid |
grid
grid of weight vectors |
protected java.lang.String |
initMethod
kind of initialising |
protected cern.colt.list.IntArrayList |
keys
list with unique keys |
protected static org.apache.log4j.Logger |
log
interface to log4j system |
protected LrnFile |
lrn
|
protected Neighborhood |
neighborhood
neighborhood kernel function |
protected cern.colt.matrix.DoubleMatrix1D |
neuron
current neuron, only used internally |
protected java.text.NumberFormat |
nf
number format for messages |
protected boolean |
offline
|
protected cern.colt.list.IntArrayList |
oldBestmatches
indices of best matching neurons for data points of last epoch |
protected boolean |
online
|
protected cern.colt.matrix.DoubleMatrix1D |
pattern
current data pattern, only used internally |
protected cern.colt.list.IntArrayList |
permutation
current permutation of the data vectors, only used internally |
protected int |
permutations
number of possible permutations of the data vectors, only used internally |
protected boolean |
permute
flag whether to permute data vectors before each epoch |
protected double |
qerror
current quantization error |
protected int |
radius
current neighborhood radius, only used internally |
protected Cooling |
radiusCooling
cooling strategy of neighborhood radius |
protected cern.jet.random.engine.RandomEngine |
random
random number generator, only used internally |
protected double |
rate
current learning rate, only used internally |
protected Cooling |
rateCooling
cooling strategy of learning rate |
protected int |
saveEpoch
number of epochs after which a bm and wts file will be saved |
protected boolean |
saveEpoches
Boolean for saving during epochs |
protected java.lang.String |
savePrefix
String with name of files during epochs |
protected boolean |
saveUMatrix
Boolean for saving U-Matrix during epochs |
protected cern.colt.matrix.DoubleMatrix2D |
view
possibly permuted view on training data, only used internally |
Constructor Summary | |
---|---|
SOM()
Standard constructor. |
Method Summary | |
---|---|
void |
afterEpoch()
Things to be done after each epoch. |
void |
afterUpdate(int index,
int row)
Things to be done after updating a weight vector. |
void |
beforeEpoch()
Things to be done before each epoch. |
void |
beforeSearch(int row)
Things to be done before searching for a best match. |
void |
beforeUpdate(int index)
Things to be done before updating a weight vector Empty by default. |
double |
calcQerror()
|
protected void |
centerMap()
center map at neuron with highest density |
void |
cool()
Cool down the parameters |
cern.colt.list.IntArrayList |
getBestMatches()
Get the indices of best matching neurons for data points Available after calling train(). |
BmSearch |
getBmSearch()
|
cern.colt.matrix.DoubleMatrix2D |
getData()
Get the matrix with the training data. |
Descriptives |
getDescriptives()
Get the statistics about the training data. |
double |
getDistance(cern.colt.matrix.DoubleMatrix1D data,
int index)
Get the distance between a dataVector and a neuron. |
double |
getDistance(int row,
int index)
Get the distance between a data row and a neuron. |
cern.colt.function.ThresholdVectorVectorFunction |
getDistanceFunction()
Get the distance function in data space |
cern.colt.matrix.DoubleMatrix1D |
getDistances()
|
int |
getEpochs()
Get the number of training epochs. |
Grid |
getGrid()
Get the grid of weight vectors. |
cern.colt.list.IntArrayList |
getKeys()
Get the keys for the data patterns. |
Neighborhood |
getNeighborhood()
Get the neighborhood kernel function. |
java.text.NumberFormat |
getNumberFormat()
Get the number format |
cern.colt.list.IntArrayList |
getOldBestmatches()
|
cern.colt.matrix.DoubleMatrix1D |
getPattern(int row)
Access to a data pattern by row number |
cern.colt.list.IntArrayList |
getPermutation()
Get the current permuation |
boolean |
getPermute()
Get the flag whether to permute data vectors before each epoch. |
int |
getRadius()
|
Cooling |
getRadiusCooling()
Get the cooling strategy of the neighborhood radius. |
Cooling |
getRateCooling()
Get the cooling strategy of learning rate. |
void |
init()
Initialize the grid of weight vectors with the current initialization method. |
boolean |
isBmStatNeeded()
|
boolean |
isCenter()
|
boolean |
loadCls(java.lang.String filename)
|
boolean |
loadData(java.lang.String filename)
Load the training data and keys from a *.lrn file |
void |
saveBestMatches(java.lang.String filename)
Save indices of best matching neurons to a *.bm file Available after calling train(). |
void |
setBestMatches(BMFile bms)
Set the indices of best matching neurons for data points |
void |
setBestMatches(cern.colt.list.IntArrayList bms)
Set the indices of best matching neurons for data points |
void |
setBmSearch(BmSearch bmSearch)
|
void |
setBmStatNeeded(boolean bmStatNeeded)
|
void |
setCenter(boolean center)
|
void |
setData(cern.colt.matrix.DoubleMatrix2D v)
Set the matrix with the training data, patterns in rows. |
void |
setDistanceFunction(cern.colt.function.ThresholdVectorVectorFunction v)
Set the distance function in data space |
void |
setDistances(cern.colt.matrix.DoubleMatrix1D distances)
|
void |
setEpochs(int v)
Set the number of training epochs. |
void |
setGrid(Grid v)
Set the grid of weight vectors. |
void |
setInit(java.lang.String initMethod)
Set the method of initialization for the weights |
void |
setKeys(cern.colt.list.IntArrayList v)
Set the list of unique keys for the data patterns. |
void |
setNeighborhood(Neighborhood v)
Set the neighborhood kernel function. |
void |
setNumberFormat(java.text.NumberFormat v)
Set the number format |
void |
setOldBestmatches(cern.colt.list.IntArrayList oldBestmatches)
|
void |
setOnline(boolean online)
|
void |
setPermute(boolean v)
Set the flag whether to permute data vectors before each epoch. |
void |
setRadiusCooling(Cooling v)
Set the cooling strategy of the neighborhood radius. |
void |
setRateCooling(Cooling v)
Set the cooling strategy of learning rate. |
void |
setSaveEpoch(int e)
Set number of epochs after which a *.bm and a *.wts are saved |
void |
setSaveEpochBoolean()
sets the boolean flag true, because we are saving during epochs |
void |
setSavePrefix(java.lang.String name)
Set the prefix for the filename used to regularily save *.bm, *.wts and *.umx files |
void |
setSaveUMatrix(boolean flag)
set the flag for saving a U-Matrix every nth epoch |
boolean |
stop()
Stopping criterion |
void |
train()
General training algorithm for the SOM. |
abstract void |
update(cern.colt.matrix.DoubleMatrix1D vector,
int bm,
int pos)
Things to be done, after finding a bestmatch, e.g. |
void |
updateNeighborhood(cern.colt.matrix.DoubleMatrix1D vector,
int bm)
Update a neuron and its neighborhood. |
void |
updateNeuron(int index,
cern.colt.matrix.DoubleMatrix1D vector,
double weight)
Update a single weight vector. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.log4j.Logger log
protected cern.colt.list.IntArrayList bestmatches
protected cern.colt.list.IntArrayList oldBestmatches
public cern.colt.matrix.DoubleMatrix2D data
protected Descriptives descriptives
protected cern.colt.matrix.DoubleMatrix2D view
protected cern.colt.list.IntArrayList keys
protected cern.colt.function.ThresholdVectorVectorFunction distanceFunction
protected int epoch
protected int epochs
protected Grid grid
protected Neighborhood neighborhood
protected cern.colt.matrix.DoubleMatrix1D neuron
protected cern.colt.matrix.DoubleMatrix1D distances
protected java.text.NumberFormat nf
protected cern.colt.matrix.DoubleMatrix1D pattern
protected cern.colt.list.IntArrayList permutation
protected int permutations
protected boolean permute
protected int radius
protected Cooling radiusCooling
protected cern.jet.random.engine.RandomEngine random
protected double rate
protected double qerror
protected Cooling rateCooling
protected int saveEpoch
protected java.lang.String initMethod
protected java.lang.String savePrefix
protected boolean saveEpoches
protected boolean saveUMatrix
protected boolean center
protected BmSearch bmSearch
protected BmSearchStat bmStat
protected boolean bmStatNeeded
protected boolean online
protected boolean offline
protected ClsFile classes
protected cern.colt.list.IntArrayList count
protected LrnFile lrn
Constructor Detail |
---|
public SOM()
Method Detail |
---|
public void init()
public void train()
public void beforeEpoch()
public void beforeSearch(int row)
row
- Row of the data patternpublic void beforeUpdate(int index)
index
- Index of neuron to be updatedpublic abstract void update(cern.colt.matrix.DoubleMatrix1D vector, int bm, int pos)
vector
- vector of databm
- index of bestmatching neuronpublic void updateNeighborhood(cern.colt.matrix.DoubleMatrix1D vector, int bm)
vector
- vector of databm
- index of bestmatching neuronpublic void updateNeuron(int index, cern.colt.matrix.DoubleMatrix1D vector, double weight)
index
- Index of neuron to be updateddataVector
- Vector of the data patternweight
- Weight of neighborhood kernel assigned by distance on gridpublic void afterUpdate(int index, int row)
index
- Index of neuron just updatedpublic void afterEpoch()
public void cool()
public boolean stop()
protected void centerMap()
public cern.colt.list.IntArrayList getBestMatches()
public void setBestMatches(cern.colt.list.IntArrayList bms)
public void setBestMatches(BMFile bms)
public void saveBestMatches(java.lang.String filename)
public Descriptives getDescriptives()
public cern.colt.matrix.DoubleMatrix2D getData()
public void setData(cern.colt.matrix.DoubleMatrix2D v)
v
- Value to assign to data.public boolean loadData(java.lang.String filename)
filename
- Name of the filepublic boolean loadCls(java.lang.String filename)
public double getDistance(int row, int index)
row
- Row of data patternindex
- Index of neuron
public double getDistance(cern.colt.matrix.DoubleMatrix1D data, int index)
data
- DataVectorindex
- Index of neuron
public cern.colt.function.ThresholdVectorVectorFunction getDistanceFunction()
public void setDistanceFunction(cern.colt.function.ThresholdVectorVectorFunction v)
v
- Value to assign to distanceFunction.public double calcQerror()
public int getEpochs()
public void setEpochs(int v)
v
- Value to assign to epochs.public Grid getGrid()
public void setGrid(Grid v)
v
- Value to assign to grid.public cern.colt.list.IntArrayList getKeys()
public void setKeys(cern.colt.list.IntArrayList v)
v
- Value to assign to keys.public Neighborhood getNeighborhood()
public void setNeighborhood(Neighborhood v)
v
- Value to assign to neighborhood.public java.text.NumberFormat getNumberFormat()
public void setNumberFormat(java.text.NumberFormat v)
v
- value of number formatpublic cern.colt.matrix.DoubleMatrix1D getPattern(int row)
row
- Row of data patternpublic boolean getPermute()
public void setPermute(boolean v)
v
- Value to assign to permute.public cern.colt.list.IntArrayList getPermutation()
public Cooling getRadiusCooling()
public void setRadiusCooling(Cooling v)
v
- Value to assign to radiusCooling.public Cooling getRateCooling()
public void setRateCooling(Cooling v)
v
- Value to assign to rateCooling.public void setSaveEpoch(int e)
e
- number of epochspublic void setSaveEpochBoolean()
public void setInit(java.lang.String initMethod)
initMethod
- name of method
allowed names are: norm_mean_2std, uni_mean_2std, uni_min_max, pcapublic void setSavePrefix(java.lang.String name)
name
- String with name of filepublic void setSaveUMatrix(boolean flag)
flag
- true for savepublic boolean isCenter()
public void setCenter(boolean center)
center
- The center to set.public cern.colt.matrix.DoubleMatrix1D getDistances()
public void setDistances(cern.colt.matrix.DoubleMatrix1D distances)
distances
- The distances to set.public BmSearch getBmSearch()
public void setBmSearch(BmSearch bmSearch)
bmSearch
- The bmSearch to set.public cern.colt.list.IntArrayList getOldBestmatches()
public void setOldBestmatches(cern.colt.list.IntArrayList oldBestmatches)
oldBestmatches
- The oldBestmatches to set.public int getRadius()
public boolean isBmStatNeeded()
public void setBmStatNeeded(boolean bmStatNeeded)
bmStatNeeded
- The bmStatNeeded to set.public void setOnline(boolean online)
online
- The online to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |