net.sourceforge.javaocr.plugin.cluster
Class AbstractBaseCluster

java.lang.Object
  extended by net.sourceforge.javaocr.plugin.cluster.AbstractBaseCluster
All Implemented Interfaces:
Metric, Cluster
Direct Known Subclasses:
EuclidianDistanceCluster, MahalanobisDistanceCluster

public abstract class AbstractBaseCluster
extends Object
implements Cluster

base cluster functionality. provides mx

Author:
Konstantin Pribluda

Field Summary
private  int amountSamples
           
private  int dimensions
           
private  double[] mx
           
private  double[] sum
           
 
Constructor Summary
  AbstractBaseCluster()
           
protected AbstractBaseCluster(double[] mx)
           
protected AbstractBaseCluster(int dimensions)
           
 
Method Summary
 double[] center()
          lazily calculate and return expectation cluster
 int getAmountSamples()
           
 int getDimensions()
           
 double[] getMx()
           
 double[] getSum()
           
 double radius(List<double[]> samples)
          calculate maximal distance for group from center
 void setAmountSamples(int amountSamples)
           
 void setDimensions(int dimensions)
           
 void setMx(double[] mx)
           
 void setSum(double[] sum)
           
 void train(double[] features)
          training means coputing sum of values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.javaocr.cluster.Metric
distance
 

Field Detail

sum

private double[] sum

mx

private double[] mx

amountSamples

private int amountSamples

dimensions

private int dimensions
Constructor Detail

AbstractBaseCluster

public AbstractBaseCluster()

AbstractBaseCluster

protected AbstractBaseCluster(int dimensions)

AbstractBaseCluster

protected AbstractBaseCluster(double[] mx)
Method Detail

center

public double[] center()
lazily calculate and return expectation cluster

Specified by:
center in interface Cluster
Returns:
expectation vector

getAmountSamples

public int getAmountSamples()

getMx

public double[] getMx()

setMx

public void setMx(double[] mx)

setDimensions

public void setDimensions(int dimensions)

getDimensions

public int getDimensions()
Specified by:
getDimensions in interface Metric

setAmountSamples

public void setAmountSamples(int amountSamples)

train

public void train(double[] features)
training means coputing sum of values. mx shall be reset and sampler countet up

Specified by:
train in interface Cluster
Parameters:
features -

getSum

public double[] getSum()

setSum

public void setSum(double[] sum)

radius

public double radius(List<double[]> samples)
calculate maximal distance for group from center

Specified by:
radius in interface Cluster
Parameters:
samples - sample group, sample size shall correspond to cluster dimensions
Returns:


Copyright © -2012. All Rights Reserved.