MasterScan  Lab_Matlab_control Master Branch
List of all members | Properties and Events | Protected Properties | Methods | Protected Methods
topsClassification Class Reference

Overview

Represents data as points in space, for classification.

topsClassification takes in data samples from multiple sources and outputs arbitrary values. It maps samples to outputs by way of a spatial model: each data source maps to a spatial dimension, each sample maps to a value along one dimension, and a set of samples maps to a point in space. Regions in the space map to arbitrary outputs, so the region in which a point falls determines the output for a sample set.

The spatial model is backed up by a high-dimensional matrix. Picking a point in space boils down to indexing into the matrix. The key is to convert arbitrary data samples into matrix indices.

Inheritance diagram for topsClassification:
Inheritance graph
[legend]

Properties and Events

Property defaultOutput = []
 default output when no other output is defined
 
Property defaultOutputName = 'default'
 name to give to the default output
 
- Properties and Events inherited from topsFoundation
Property name = ''
 a string name to indentify the object
 
Property clockFunction =@topsClock
 clock function, to standardize
 

Protected Properties

 sources
 struct array of data sources and descriptions
 
Property space
 topsSpace with spatial modeling utilities
 
 outputs
 struct array of spatial regions and outputs
 
Property outputTable
 high-dimensional matrix for looking up output
 

Methods

self topsClassification (varargin)
 Constuct with name optional. More...
 
fig gui (self)
 Open a GUI to view object details. More...
 
index addSource (self, name, sampleFunction, minimum, maximum, nPoints)
 Add a data source. More...
 
index removeSource (self, name)
 Remove a data source by name. More...
 
index addOutput (self, name, region, value)
 Add a classification output. More...
 
index removeOutput (self, name)
 Remove a classification output by name. More...
 
index editOutputValue (self, name, value)
 Change the value mapped from an existing output. More...
 
 updateSamples (self)
 Update source samples. More...
 
value name getOutput (self, doUpdate)
 Get the current classification output. More...
 
- Methods inherited from topsFoundation
self topsFoundation (name)
 Constuct with name optional. More...
 
fig gui (self)
 Open a GUI to view object details. More...
 
guiPanel (self, varargin)
 Make a topsDetailPanel with details about this object. More...
 

Protected Methods

 buildSpace (self)
 Rebuild the data space. More...
 
 clearOutputs (self)
 Clear out the outputTable lookuptable.
 
 buildOutputTable (self)
 Rebuild the outputTable lookuptable.
 

Additional Inherited Members

- Static Methods inherited from topsFoundation
static c index cellAdd (c, item, index)
 Add an item to a cell array. More...
 
static selector cellContains (c, item)
 Does a cell array conatin an item? More...
 
static c cellRemoveItem (c, item)
 Remove an item from a cell array. More...
 
static c cellRemoveElement (c, index)
 Remove indexed elements from a cell array. More...
 
static index selector findStructName (s, name)
 Where is the given name in the given struct array? More...
 

Constructor

◆ topsClassification()

self topsClassification ( varargin  )

Constuct with name optional.

Parameters
nameoptional name for this object

If name is provided, assigns name to this object.

Methods

◆ gui()

fig gui ( self  )

Open a GUI to view object details.

Opens a new GUI with components suitable for viewing objects of this class. Returns a topsFigure object which contains the GUI.

◆ addSource()

index addSource ( self  ,
name  ,
sampleFunction  ,
minimum  ,
maximum  ,
nPoints   
)

Add a data source.

Parameters
nameunique name for the data source
sampleFunctionfunction_handle that returns a sample
minimumminimum sample value to expect
maximummaximum sample value to expect
nPointspoints to use between minumum and maximum

Adds a data source to be included in classification. name must be unique so that the source can be referred to later by name. Any existing source with the same name will be replaced. This will invalidate existing outputs, because it changes the spatial model.

sampleFunction must be function handle, and the function should return a scalar, numeric sample value for the named source.

minimum and maximum must be the minumum and maximum expected sample values from the named source. nPoints must be the number of points to space evenly between minimum and maximum. minimum, maximum, and nPoints are used to convert raw sample values into high-dimensional matrix indices.

Returns the intex into sources where the source was inserted or appended.

◆ removeSource()

index removeSource ( self  ,
name   
)

Remove a data source by name.

Parameters
nameunique name of a data source

Removes the named data source. This will invalidate existing outputs, because it changes the spatial model.

Returns the index into sources where the named source was removed, or [] if no source was found.

◆ addOutput()

index addOutput ( self  ,
name  ,
region  ,
value   
)

Add a classification output.

Parameters
nameunique name for the output
regiontopsRegion spatial region that maps to the output
valueoutput value mapped from region

Adds an output value that can be returned as a classification result. region must be a topsRegion object specifying the region of the spatial model that should map to value. name must be a unique name for this region-value pair.

If multiple output regions overlap, those that were added later take presidence.

Returns the index into outputs where the named output was inserted or appended.

◆ removeOutput()

index removeOutput ( self  ,
name   
)

Remove a classification output by name.

Parameters
nameunique name of a classification output

Removes the named output from classification. Returns the index into outputs where the named output was removed, or [] if no output was found.

◆ editOutputValue()

index editOutputValue ( self  ,
name  ,
value   
)

Change the value mapped from an existing output.

Parameters
nameunique name of a classification output
valuenew value for the named output

Change the output value associated with the given name. The spatial region associated with name remians the same, but the value, as returned from getOutput() is replaced with the new value.

Returns the index into outputs where the named value was changed, or [] if no output was found.

◆ updateSamples()

updateSamples ( self  )

Update source samples.

Retrieves new samples for each data source, using the sampleFunction provided for each source in addSource().

◆ getOutput()

value name getOutput ( self  ,
doUpdate   
)

Get the current classification output.

Parameters
doUpdateoptional, whether invoke updateSamples() first

Uses the current sample value of all sources to locate a point in the spatial model and return the associated output value. Returns as a second output the name of the output. By default, invokes updateSamples() to refresh source sample values. if doUpdate is provided and false, leaves source samples as they are.

◆ buildSpace()

buildSpace ( self  )
protected

Rebuild the data space.

Invalidate now-stale outputs and reallocate the outputTable.


The documentation for this class was generated from the following file: