fsmvis.engine
Class SubsetNeighbourAndSampleModel

java.lang.Object
  |
  +--fsmvis.engine.SpringModel
        |
        +--fsmvis.engine.NeighbourAndSampleModel
              |
              +--fsmvis.engine.SubsetNeighbourAndSampleModel
Direct Known Subclasses:
InterpolateSampleModel

public class SubsetNeighbourAndSampleModel
extends NeighbourAndSampleModel

See Also:
Serialized Form

Field Summary
protected  boolean kmeans
           
protected  java.util.HashSet numbers
           
protected static java.lang.String ROOT_N_FACTOR
           
protected static int rootNFactor
           
protected  java.util.ArrayList subset
           
protected  java.util.HashSet subsetContents
           
protected  int subsetSize
           
 
Fields inherited from class fsmvis.engine.NeighbourAndSampleModel
NEIGHBOUR_SIZE, neighbours, neighbourSize, SAMPLE_SIZE, samples, sampleSize
 
Fields inherited from class fsmvis.engine.SpringModel
dampingFactor, dataItems, dataSizeFactor, deltaTime, endC, force, freeness, gravityDampingForce, gravityForce, kMeansTime, layoutBounds, numIterations, position, properties, rangeHi, rangeLo, runningTime, springForce, startTime, timeDampingForce, timeForce, unrelatedDist, velocity, viewParent
 
Constructor Summary
SubsetNeighbourAndSampleModel(DataItemCollection dataItems, EndCriteria ec, Viewer v)
          constructor: specifies the data item collection to be used
SubsetNeighbourAndSampleModel(DataItemCollection dataItems, int[] intSubSet, EndCriteria ec, Viewer v, int kTime)
          2nd constructor: specifies the data item collection to be used and the subset.
 
Method Summary
 void doIteration()
          Method to perform one iteration of the layout algorithm for this layout model
 void doNormalise()
          Instruction to normalise data for spring model
 double getApproxError()
          Calculates the approximate error in this layout, does this by calcing the value for a subset of the data set to get an approximation of the error without slowing down the layout too much.
 double getApproxVelocity()
          Returns an approximation of the average error in the data set
 double getAvgError()
          Returns the average error in the data set
 double getAvgVelocity()
          Returns the average velocity in the data set
 double getStress()
          Calculates stress over sample
 int getSubsetSize()
          Returns the subset size that is being used for this layout
 void initValues()
          Initialises the values for this class, over rides the method in Spring model.
 void iterateFullSet()
          Method to perform one iteration of the layout algorithm for the full data set
 void loadProperties()
          Initialises the properties for this object to be the properties held for this object
protected  void randomizeSample(int index)
          Creates a new arrayList of random numbers to be used by the samples ArrayList.
 void setSubset(java.util.ArrayList subset)
          Sets the subset of dataItems to be used with this layout model to be the arraylist of integers subset
 void setSubsetSize(int subsetSize)
          Sets the subsetSize to be subsetSize
 
Methods inherited from class fsmvis.engine.NeighbourAndSampleModel
calcForces, findNewNeighbours, randomizeSample, setSizes
 
Methods inherited from class fsmvis.engine.SpringModel
addForces, calcGravityForce, calcTimeForce, getDataItem, getDataItemCollection, getDisplayableItems, getExecutionTime, getNumIterations, getPosition, getProperties, init, integrateChanges, randomizePositions, resetIterations, setDataItemCollection, updateValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

subset

protected java.util.ArrayList subset

subsetContents

protected java.util.HashSet subsetContents

subsetSize

protected int subsetSize

rootNFactor

protected static int rootNFactor

ROOT_N_FACTOR

protected static final java.lang.String ROOT_N_FACTOR

kmeans

protected boolean kmeans

numbers

protected java.util.HashSet numbers
Constructor Detail

SubsetNeighbourAndSampleModel

public SubsetNeighbourAndSampleModel(DataItemCollection dataItems,
                                     EndCriteria ec,
                                     Viewer v)
constructor: specifies the data item collection to be used
Parameters:
dataItems - The data item collection to be used with this layout model

SubsetNeighbourAndSampleModel

public SubsetNeighbourAndSampleModel(DataItemCollection dataItems,
                                     int[] intSubSet,
                                     EndCriteria ec,
                                     Viewer v,
                                     int kTime)
2nd constructor: specifies the data item collection to be used and the subset.
Parameters:
dataItems - The data item collection to be used with this layout model
Method Detail

doNormalise

public void doNormalise()
Instruction to normalise data for spring model
Overrides:
doNormalise in class NeighbourAndSampleModel

loadProperties

public void loadProperties()
Initialises the properties for this object to be the properties held for this object
Overrides:
loadProperties in class NeighbourAndSampleModel

initValues

public void initValues()
Initialises the values for this class, over rides the method in Spring model. Makes a call to super first.
Overrides:
initValues in class NeighbourAndSampleModel

setSubset

public void setSubset(java.util.ArrayList subset)
Sets the subset of dataItems to be used with this layout model to be the arraylist of integers subset
Parameters:
subset - The subset to be used

iterateFullSet

public void iterateFullSet()
Method to perform one iteration of the layout algorithm for the full data set

doIteration

public void doIteration()
                 throws TooManyIterationsException
Method to perform one iteration of the layout algorithm for this layout model
Overrides:
doIteration in class SpringModel

randomizeSample

protected void randomizeSample(int index)
Creates a new arrayList of random numbers to be used by the samples ArrayList. This list will contain a sampleSize random numbers, corresponding to dataItem indices, such that none of the values are the same as ones already in the sample or already in the neighbours list and are between 0 and dataItems.getSize(). THe resulting list will be stored in samples[index]. Overrides the method in NeighbourAndSampleModel, only selects samples from the subset arrayList
Parameters:
index - The index of the samples arrayList to store the result
Overrides:
randomizeSample in class NeighbourAndSampleModel

getSubsetSize

public int getSubsetSize()
Returns the subset size that is being used for this layout
Returns:
The subset size that is being used

setSubsetSize

public void setSubsetSize(int subsetSize)
Sets the subsetSize to be subsetSize
Parameters:
subsetSize - The new size of the subset

getApproxError

public double getApproxError()
Calculates the approximate error in this layout, does this by calcing the value for a subset of the data set to get an approximation of the error without slowing down the layout too much.
Returns:
The approximation of the avg error
Overrides:
getApproxError in class SpringModel

getAvgError

public double getAvgError()
Returns the average error in the data set
Returns:
the average error
Overrides:
getAvgError in class SpringModel

getApproxVelocity

public double getApproxVelocity()
Returns an approximation of the average error in the data set
Returns:
An approx of the avg velocity
Overrides:
getApproxVelocity in class SpringModel

getAvgVelocity

public double getAvgVelocity()
Returns the average velocity in the data set
Returns:
the average velocity
Overrides:
getAvgVelocity in class SpringModel

getStress

public double getStress()
Calculates stress over sample
Returns:
stress
Overrides:
getStress in class SpringModel