FluidManipulation data classes help files, pass 0
parent
f61c7db147
commit
0af28a18ba
@ -0,0 +1,78 @@
|
||||
TITLE:: FluidKDTree
|
||||
summary:: KD Tree on the server
|
||||
categories:: FluidManipulation
|
||||
related:: Classes/FluidDataSet
|
||||
|
||||
DESCRIPTION::
|
||||
A server-side K-Dimensional tree for efficient neighbourhood searches of multi-dimensional data. See https://scikit-learn.org/stable/modules/neighbors.html#nearest-neighbor-algorithms for more on KD Trees
|
||||
|
||||
CLASSMETHODS::
|
||||
|
||||
INSTANCEMETHODS::
|
||||
|
||||
METHOD:: read
|
||||
Set the object's state from a JSON file
|
||||
|
||||
ARGUMENT:: filename
|
||||
The location of a JSON file on disk
|
||||
|
||||
ARGUMENT:: action
|
||||
function to run when the data is loaded
|
||||
|
||||
METHOD:: kNearestDist
|
||||
Get the distances of the K nearest neighbours to a point
|
||||
|
||||
ARGUMENT:: buffer
|
||||
A LINK::Classes/Buffer:: containing a data point to match against. The number of frames in the buffer must match the dimensionality of the LINK::Classes/FluidDataSet:: the tree was fitted to.
|
||||
|
||||
ARGUMENT:: k
|
||||
The number of neighbours to search
|
||||
|
||||
ARGUMENT:: action
|
||||
A function that will run when the query returns, whose argument is an array of distances
|
||||
|
||||
returns:: nothing, but could return an array if you like
|
||||
|
||||
METHOD:: fit
|
||||
Build the tree by scanning the points of a LINK::Classes/FluidDataSet::
|
||||
|
||||
ARGUMENT:: dataset
|
||||
The LINK::Classes/FluidDataSet:: of interest. This can either be a data set object itself, or the name of one.
|
||||
|
||||
ARGUMENT:: action
|
||||
A function to run when indexing is complete
|
||||
|
||||
METHOD:: write
|
||||
Write the index of the tree to disk. Currently this will not overwrite extant files.
|
||||
|
||||
ARGUMENT:: filename
|
||||
The path of a JSON file to write
|
||||
|
||||
ARGUMENT:: action
|
||||
A function to run when writing is complete
|
||||
|
||||
METHOD:: kNearest
|
||||
Returns the IDs of the CODE::k:: points nearest to the one passed
|
||||
|
||||
ARGUMENT:: buffer
|
||||
A LINK::Classes/Buffer:: containing a data point to match against. The number of frames in the buffer must match the dimensionality of the LINK::Classes/FluidDataSet:: the tree was fitted to.
|
||||
|
||||
ARGUMENT:: k
|
||||
The number of neighbours to return
|
||||
|
||||
ARGUMENT:: action
|
||||
A function that will run when the query returns, whose argument is an array of point IDs from the tree's LINK::Classes/FluidDataSet::
|
||||
|
||||
returns:: Nothing, but could return an array of IDs if you like
|
||||
|
||||
METHOD:: cols
|
||||
Get the dimensionality of the data that the tree is indexed against
|
||||
|
||||
ARGUMENT:: action
|
||||
A function that runs when the query returns, whose argument is the dimensionality
|
||||
|
||||
EXAMPLES::
|
||||
|
||||
code::
|
||||
(some example code)
|
||||
::
|
||||
@ -0,0 +1,68 @@
|
||||
TITLE:: FluidKNN
|
||||
summary:: K Nearest Neighbours machine learning
|
||||
categories:: FluidManipulation
|
||||
related:: Classes/FluidKDTree
|
||||
|
||||
DESCRIPTION::
|
||||
Simple machine learning tasks (classification and regression) using K Nearest Neighbours.
|
||||
|
||||
See
|
||||
https://scikit-learn.org/stable/modules/neighbors.html#nearest-neighbors-classification
|
||||
|
||||
https://scikit-learn.org/stable/modules/neighbors.html#nearest-neighbors-regression
|
||||
|
||||
|
||||
CLASSMETHODS::
|
||||
|
||||
INSTANCEMETHODS::
|
||||
|
||||
METHOD:: fit
|
||||
'Train' the KNN on a source link::Classes/FluidDataSet::
|
||||
|
||||
ARGUMENT:: dataset
|
||||
source link::Classes/FluidDataSet::
|
||||
|
||||
ARGUMENT:: action
|
||||
A function to run when fitting is complete
|
||||
|
||||
METHOD:: regress
|
||||
Map a point between a source link::Classes/FluidDataSet:: used when link::Classes/FluidKNN#index::ing this KNN, and a target data set passed as an argument.
|
||||
|
||||
For this to work, the target data set must have labels in common with the source data set. The code::k:: nearest neighbours to the supplied data point are retrrived from the source tree, and then a mapping is obtained through the average of the equivalently labelled points in the target data set.
|
||||
|
||||
WARNING:: For now the target data set can only be 1D::
|
||||
|
||||
ARGUMENT:: buffer
|
||||
The data point to map, in a link::Classes/Buffer::
|
||||
|
||||
ARGUMENT:: dataset
|
||||
The target link::Classes/FluidDataSet::
|
||||
|
||||
ARGUMENT:: k
|
||||
The number of neighbours to use in the estimation
|
||||
|
||||
ARGUMENT:: action
|
||||
A function to run when the server responds, taking the value of the regressed point as its argument
|
||||
|
||||
METHOD:: classify
|
||||
Classify a point, using categories from the supplied label set, which maps labels from the source data set to category IDs. This works by getting the labels of the code::k:: nearest points to the passed data point from the source data set, and looking up their IDs in the passed label set. The most frequently ocurring ID is designated as the class for the point.
|
||||
|
||||
ARGUMENT:: buffer
|
||||
The data point to classify, in a link::Classes/Buffer::
|
||||
|
||||
ARGUMENT:: labelset
|
||||
A link::Classes/FluidLabelSet:: of categories mapped to labels in source data set
|
||||
|
||||
ARGUMENT:: k
|
||||
The number of neighbours to use in the classificaton
|
||||
|
||||
ARGUMENT:: action
|
||||
A function to run when the server responds, taking the assigned label as its argument
|
||||
|
||||
|
||||
|
||||
EXAMPLES::
|
||||
|
||||
code::
|
||||
(some example code)
|
||||
::
|
||||
@ -0,0 +1,97 @@
|
||||
TITLE:: FluidLabelSet
|
||||
summary:: A set of labels associated with IDs
|
||||
categories:: FluidManipulation
|
||||
related:: Classes/FluidDataSet, Classes/FluidKMeans
|
||||
|
||||
DESCRIPTION::
|
||||
FluidLabelSet is a server-side container of associations between labels (from a link::Classes/FluidDataSet::) and IDs, for instance from some clustering or classification of the points in a data set.
|
||||
|
||||
|
||||
CLASSMETHODS::
|
||||
|
||||
PRIVATE:: kr
|
||||
|
||||
METHOD:: new
|
||||
Make a new instance of a label set, uniquely identified by its name. Multiple instances to of this class with the same name refer to the same server-side entity.
|
||||
|
||||
ARGUMENT:: server
|
||||
The link::Classes/Server:: on which to create the label set
|
||||
|
||||
ARGUMENT:: name
|
||||
symbol or string with the label set's name
|
||||
|
||||
INSTANCEMETHODS::
|
||||
|
||||
PRIVATE:: init, id, server, synth
|
||||
|
||||
METHOD:: getLabel
|
||||
Retreive the label associated with an ID. Will report an error if the ID isn't present in the set
|
||||
|
||||
ARGUMENT:: id
|
||||
symbol or string with the ID to retreive.
|
||||
|
||||
ARGUMENT:: action
|
||||
A function to run when the server responds, with the label as its argument
|
||||
|
||||
METHOD:: cols
|
||||
Returns the dimensionality of the link::Classes/FluidDataSet:: associated with this label set
|
||||
|
||||
ARGUMENT:: action
|
||||
A function to run when the server responds, with the dimensionality as its argument
|
||||
|
||||
METHOD:: write
|
||||
Write this label set to disk as a JSON file. Will not overwrite existing files.
|
||||
|
||||
ARGUMENT:: filename
|
||||
Absolute path of file to write
|
||||
|
||||
ARGUMENT:: action
|
||||
A function to run when the file is written
|
||||
|
||||
METHOD:: read
|
||||
Read a label set from a JSON file on disk
|
||||
|
||||
ARGUMENT:: filename
|
||||
Absolute path of the file to read
|
||||
|
||||
ARGUMENT:: action
|
||||
A function to run when the file is read
|
||||
|
||||
METHOD:: deleteLabel
|
||||
Remove a id-label pair from the label set
|
||||
|
||||
ARGUMENT:: id
|
||||
symbol or string with the ID to remove
|
||||
|
||||
ARGUMENT:: action
|
||||
A function to run when the label has been removed
|
||||
|
||||
METHOD:: size
|
||||
Report the num er of items in the label set
|
||||
|
||||
ARGUMENT:: action
|
||||
A function to run when the server responds, taking the size as its argument
|
||||
|
||||
METHOD:: addLabel
|
||||
Add a label to the label set
|
||||
|
||||
ARGUMENT:: id
|
||||
symbol or string with the ID for this label
|
||||
|
||||
ARGUMENT:: label
|
||||
symbol or string with the label to add
|
||||
|
||||
ARGUMENT:: action
|
||||
function to run when the operation completes
|
||||
|
||||
METHOD:: clear
|
||||
Empty the label set
|
||||
|
||||
ARGUMENT:: action
|
||||
Function to run whrn the action completes
|
||||
|
||||
EXAMPLES::
|
||||
|
||||
code::
|
||||
(some example code)
|
||||
::
|
||||
Loading…
Reference in New Issue