MasterScan
Lab_Matlab_control Master Branch
|
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.
Properties and Events | |
Property | defaultOutput = [] |
default output when no other output is defined | |
Property | defaultOutputName = 'default' |
name to give to the default output | |
![]() | |
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... | |
![]() | |
self | topsFoundation (name) |
Constuct with name optional. More... | |
fig | gui (self) |
Open a GUI to view object details. More... | |
p | 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 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... | |
self topsClassification | ( | varargin | ) |
Constuct with name optional.
name | optional name for this object |
If name is provided, assigns name to this object.
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.
index addSource | ( | self | , |
name | , | ||
sampleFunction | , | ||
minimum | , | ||
maximum | , | ||
nPoints | |||
) |
Add a data source.
name | unique name for the data source |
sampleFunction | function_handle that returns a sample |
minimum | minimum sample value to expect |
maximum | maximum sample value to expect |
nPoints | points 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.
index removeSource | ( | self | , |
name | |||
) |
Remove a data source by name.
name | unique 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.
index addOutput | ( | self | , |
name | , | ||
region | , | ||
value | |||
) |
Add a classification output.
name | unique name for the output |
region | topsRegion spatial region that maps to the output |
value | output 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.
index removeOutput | ( | self | , |
name | |||
) |
Remove a classification output by name.
name | unique 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.
index editOutputValue | ( | self | , |
name | , | ||
value | |||
) |
Change the value mapped from an existing output.
name | unique name of a classification output |
value | new 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 | ( | self | ) |
Update source samples.
Retrieves new samples for each data source, using the sampleFunction provided for each source in addSource().
value name getOutput | ( | self | , |
doUpdate | |||
) |
Get the current classification output.
doUpdate | optional, 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.
|
protected |
Rebuild the data space.
Invalidate now-stale outputs and reallocate the outputTable.