From 8bc297cb8a0886f36750eb60d47dbaf8cfd23e9a Mon Sep 17 00:00:00 2001 From: lewardo Date: Thu, 31 Aug 2023 15:39:12 +0100 Subject: [PATCH 01/17] `dataseries` initial ref --- doc/DataSeries.rst | 163 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 doc/DataSeries.rst diff --git a/doc/DataSeries.rst b/doc/DataSeries.rst new file mode 100644 index 0000000..29a17dc --- /dev/null +++ b/doc/DataSeries.rst @@ -0,0 +1,163 @@ +:digest: A set of data series associated with identifiers. +:species: data +:sc-categories: UGens>FluidManipulation +:sc-related: Classes/Dictionary +:see-also: LabelSet, DataSet, DTW, +:max-seealso: dict +:description: FluidDataSeries is a container associating series of data points with identifiers. + + +:control name: + + The name of the FluidDataSeries. This is unique between all FluidDataSeries. + + +:message addFrame: + + :arg identifier: The identifier for the series to add to. + + :arg buffer: A |buffer| containing the data for the frame (only the first channel is used). + + Add a new frame to the end of a series, creates the series if it does not exist. Sets the dimensionality of the DataSeries if it is the first frame added, otherwise if the buffer is too short an error will be reported. + + +:message addSeries: + + :arg identifier: The identifier for the series to add. + + :arg buffer: A |buffer| containing the data for the series (each channel is a distinct time frame). + + Add a new series from a buffer. Sets the dimensionality of the DataSeries if it is the first series added, otherwise if the buffer is too short an error will be reported. If the identifier already exists an error will be reported. + + +:message getFrame: + + :arg identifier: The identifier for the series to get from. + + :arg time: which time frame to get. + + :arg buffer: A |buffer| to write the frame to (only the first channel is used, will be resized). + + Get a frame from a series. If the identifier doesn't exist or if that series doesnt have a frame for that time point an error will be reported. + + +:message getSeries: + + :arg identifier: The identifier for the series to get. + + :arg buffer: A |buffer| containing the data for the series (each channel is a distinct time frame, will be resized). + + Get a series. If the identifier doesn't exist an error will be reported. + + +:message setFrame: + + :arg identifier: The identifier for the series to set a frame in. + + :arg time: which time frame to set. + + :arg buffer: A |buffer| containing the data for the frame (only the first channel is used). + + Updates a time frame in a series, or adds it to the end if there is no frame at that time point. Sets the dimensionality of the DataSeries if it is the first frame added, otherwise if the buffer is too short an error will be reported. + + +:message setSeries: + + :arg identifier: The identifier for the series to set. + + :arg buffer: A |buffer| containing the data for the series (each channel is a distinct time frame). + + Updates a time series, or adds it if it doesn't exist. Sets the dimensionality of the DataSeries if it is the first series added, otherwise if the buffer is too short an error will be reported. + + +:message updateFrame: + + :arg identifier: The identifier for the series to update a frame in. + + :arg time: which time frame to update. + + :arg buffer: A |buffer| containing the data for the frame (only the first channel is used). + + Updates an existing frame. If the buffer is too short an error will be reported. If the identifier doesn't exist or if that series doesnt have a frame for that time point an error will be reported. + + +:message updateSeries: + + :arg identifier: The identifier for the series to update. + + :arg buffer: A |buffer| containing the data for the series (each channel is a distinct time frame). + + Updates a new series. If the buffer is too short an error will be reported. If the identifier doesn't exist an error will be reported. + + +:message deleteFrame: + + :arg identifier: The identifier for the series to delete a frame from. + + :arg time: which time frame to remove. + + Delete a frame from a series, deletes the series if it is the last frame. If the identifier doesn't exist or if that series doesnt have a frame for that time point an error will be reported. + + +:message deleteSeries: + + :arg identifier: The identifier for the series to delete. + + Delete a series. If the identifier doesn't exist an error will be reported. + + +:message getDataSet: + + :arg dataSet: The Dataset to write the slice to. Will overwrite and resize. + + :arg time: which time frame to extract. + + Get a dataset with the `time`th frame of every series, for examples create a :fluid-obj:`DataSet` with every first frame of every point. If an identifier doesn't have enough points it is merely not added to the output dataset. + + +:message clear: + + Empty the data series of all series and frames. + + +:message getIds: + + :arg labelSet: The FluidLabelSet to export to. Its content will be replaced. + + Export the dataset identifiers to a :fluid-obj:`LabelSet`. + + +:message merge: + + :arg sourceDataSet: The source DataSet to be merged. + + :arg overwrite: A flag to allow overwrite points with the same identifier. + + Merge sourceDataSeries in the current DataSeries. It will replace the value of points with the same identifier if overwrite is set to 1. + + +:message print: + + Post an abbreviated content of the DataSeries in the window by default, but you can supply a custom action instead. + + +:message read: + + :arg filename: (optional) filename to save to + + Read a saved object in JSON format from disk, will prompt for file location if not filename not provided + + +:message write: + + Save the contents of the object to a JSON file on disk to the file specified, will prompt for file location if not filename not provided + + +:message load: + + Load the state of this object from a Dictionary. + + +:message dump: + + Dump the state of this object as a Dictionary. From cd16f5aa9ca48ac638003bfbe228d78a4d92522b Mon Sep 17 00:00:00 2001 From: lewardo Date: Thu, 31 Aug 2023 15:41:19 +0100 Subject: [PATCH 02/17] add `knearest` and `knearestdist` to `dataseries` --- doc/DataSeries.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/DataSeries.rst b/doc/DataSeries.rst index 29a17dc..108703a 100644 --- a/doc/DataSeries.rst +++ b/doc/DataSeries.rst @@ -136,6 +136,24 @@ Merge sourceDataSeries in the current DataSeries. It will replace the value of points with the same identifier if overwrite is set to 1. +:message kNearest: + + :arg buffer: A |buffer| containing a data point to match against. + + :arg k: The number of nearest neighbours to return. + + Returns the identifiers of the ``k`` points nearest to the one passed in distance order (closest first). Note that this is a brute force distance measure, and inefficient for repeated queries against large dataseries. + + +:message kNearestDist: + + :arg buffer: A |buffer| containing a data point to match against. The number of frames in the buffer must match the dimensionality of the DataSet. + + :arg k: The number of nearest neighbours to return. The identifiers will be sorted, beginning with the nearest. + + Returns the distances to the ``k`` points nearest to the one passed in descending order. Note that this is a brute force distance measure, and inefficient for repeated queries against large dataseries. + + :message print: Post an abbreviated content of the DataSeries in the window by default, but you can supply a custom action instead. From e32ab9925b736e37de7e98873970df0e075ffda1 Mon Sep 17 00:00:00 2001 From: lewardo Date: Tue, 5 Sep 2023 14:31:53 +0100 Subject: [PATCH 03/17] `dtwclassifier` and `dtwregressor` refs --- doc/DTWClassifier.rst | 77 +++++++++++++++++++++++++++++++++++++++++ doc/DTWRegressor.rst | 80 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 157 insertions(+) create mode 100644 doc/DTWClassifier.rst create mode 100644 doc/DTWRegressor.rst diff --git a/doc/DTWClassifier.rst b/doc/DTWClassifier.rst new file mode 100644 index 0000000..93db79c --- /dev/null +++ b/doc/DTWClassifier.rst @@ -0,0 +1,77 @@ +:digest: Series Classification with K-Nearest Neighbours using Dynamic Time Warping +:species: data +:sc-categories: Classification, DTW +:sc-related: +:see-also: DTW, DataSeries, LabelSet +:description: A nearest neighbour classifier using a :fluid-obj:`DTW`. + +:discussion: + + To keep with the interface of the :fluid-obj:`DTWClassifier`, the DTWClassifier must first be ``fit`` with a :fluid-obj:`DataSeries` of data points and a target :fluid-obj:`LabelSet` with a label for each point in the DataSeries (by means of a shared identifier). + + To classify a point, ``numNeighbours`` neighbours are determined for the incoming point, and each of those neighbours' label is given a score based on the distance to the target, neighbours with the same label only increase the likelyhood of that label being considered the nearest. The label with the highest score is considered to be the closest and returned. + + Keep in mind that this is a brute-force measure, so evaluation will become very slow for large numbers of points or long series. + +:control numNeighbours: + + The number of neighbours to consider + +:control constraint: + + The constraint to use in the `DTW` algorithm when calculating the distance between two time series. 'Warping' in this context means how distorted the genral shape of the series is. + For example, a pulse with a fast attack and slow decay will register as identical to the case with fast decay and slow attack, since stretching the time series can make it match in shape. If constraints are applied however, the amount of warping is restricted, so that the general shape of the series is kept. + + See https://rtavenar.github.io/blog/dtw.html#setting-additional-constraints for a beautiful visual explanation of the constraints + + :enum: + + :0: + **unconstrained** (any point can warp to any other) + + :1: + **ikatura** (the start and end can only warp a little, whereas the middle can warp more) + + :2: + **sakoe-chiba** (each point can only warp within a certain radius) + + +:control radius: + + The maximum radius a frame can warp away from its initial location when using a ``sakoe-chiba`` constraint. A higher value results in being able to warp more + + +:control gradient: + + Parameter for the ``ikatura`` constraint. A higher value results in being able to warp more. + +:message fit: + + :arg dataSeries: Source :fluid-obj:`DataSeries` + + :arg labelSet: A :fluid-obj:`LabelSet` of labels for the source :fluid-obj:`DataSet` + + Fit the model to a source :fluid-obj:`DataSeries` and a target :fluid-obj:`LabelSet`. The labels in the :fluid-obj:`LabelSet` correspond to the data points in the :fluid-obj:`DataSeries` by means of a shared identifier. + + +:message predict: + + :arg dataSeries: A :fluid-obj:`DataSeries` of data series to predict labels for + + :arg labelSet: A :fluid-obj:`LabelSet` to write the predicted labels into + + Given the fitted model, predict labels for a :fluid-obj:`DataSeries` and write these to a :fluid-obj:`LabelSet` + + +:message predictPoint: + + :arg buffer: A data series stored in a |buffer| + + Given a fitted model, predict a label for a data point in |buffer| and return to the caller + + +:message clear: + + Clears the :fluid-obj:`DataSeries` and :fluid-obj:`LabelSet` + + diff --git a/doc/DTWRegressor.rst b/doc/DTWRegressor.rst new file mode 100644 index 0000000..e5d2879 --- /dev/null +++ b/doc/DTWRegressor.rst @@ -0,0 +1,80 @@ +:digest: Series Regression with K-Nearest Neighbours using Dynamic Time Warping +:species: data +:sc-categories: Regression, DTW +:sc-related: +:see-also: DTW, DataSeries, DataSet +:description: A nearest neighbour classifier using a :fluid-obj:`DTW`. + +:discussion: + + To keep with the interface of the :fluid-obj:`DTWRegressor`, the DTWRegressor must first be ``fit`` with a :fluid-obj:`DataSeries` of data points and a target :fluid-obj:`DataSet` with a mapping for each point in the DataSeries (by means of a shared identifier). + + To calculate a point, ``numNeighbours`` neighbours are determined for the incoming point, and a distance-weighted sum of those neighbours' corresponding outputs is returned. + + Keep in mind that this is a brute-force measure, so evaluation will become very slow for large numbers of points or long series. + + See https://rtavenar.github.io/blog/dtw.html for an explanation of the DTW algorithm, though it can roughly be summed up as a metric measuring the similarity between two sime series, while accounting for the fact that features arent necessarily the same length. + +:control numNeighbours: + + The number of neighbours to consider + +:control constraint: + + The constraint to use in the `DTW` algorithm when calculating the distance between two time series. 'Warping' in this context means how distorted the genral shape of the series is. + For example, a pulse with a fast attack and slow decay will register as identical to the case with fast decay and slow attack, since stretching the time series can make it match in shape. If constraints are applied however, the amount of warping is restricted, so that the general shape of the series is kept. + + See https://rtavenar.github.io/blog/dtw.html#setting-additional-constraints for a beautiful visual explanation of the constraints + + :enum: + + :0: + **unconstrained** (any point can warp to any other) + + :1: + **ikatura** (the start and end can only warp a little, whereas the middle can warp more) + + :2: + **sakoe-chiba** (each point can only warp within a certain radius) + + +:control radius: + + The maximum radius a frame can warp away from its initial location when using a ``sakoe-chiba`` constraint. A higher value results in being able to warp more + + +:control gradient: + + Parameter for the ``ikatura`` constraint. A higher value results in being able to warp more. + + +:message fit: + + :arg dataSeries: Source :fluid-obj:`DataSeries` + + :arg labelSet: A :fluid-obj:`LabelSet` of labels for the source :fluid-obj:`DataSet` + + Fit the model to a source :fluid-obj:`DataSeries` and a target :fluid-obj:`LabelSet`. The labels in the :fluid-obj:`LabelSet` correspond to the data points in the :fluid-obj:`DataSeries` by means of a shared identifier. + + +:message predict: + + :arg dataSeries: A :fluid-obj:`DataSeries` of data series to predict labels for + + :arg labelSet: A :fluid-obj:`LabelSet` to write the predicted labels into + + Given the fitted model, predict the output for a :fluid-obj:`DataSeries` and write these to a :fluid-obj:`DataSet` + + +:message predictPoint: + + :arg buffer: A data series stored in a |buffer| + + Given a fitted model, predict the output for a data point in |buffer| and return to the caller + + +:message clear: + + Clears the :fluid-obj:`DataSeries` and :fluid-obj:`LabelSet` + + From 596f13c43896f17b41a89535c7b7d2a4d4cc7bd3 Mon Sep 17 00:00:00 2001 From: lewardo Date: Tue, 5 Sep 2023 14:49:52 +0100 Subject: [PATCH 04/17] `DTW` ref --- doc/DTW.rst | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 doc/DTW.rst diff --git a/doc/DTW.rst b/doc/DTW.rst new file mode 100644 index 0000000..41a3832 --- /dev/null +++ b/doc/DTW.rst @@ -0,0 +1,66 @@ +:digest: Series Classification with K-Nearest Neighbours using Dynamic Time Warping +:species: data +:sc-categories: Classification, DTW +:sc-related: +:see-also: DTW, DataSeries, LabelSet +:description: A nearest neighbour classifier using a :fluid-obj:`DTW`. + +:discussion: + + To keep with the interface of the :fluid-obj:`DTWClassifier`, the DTWClassifier must first be ``fit`` with a :fluid-obj:`DataSeries` of data points and a target :fluid-obj:`LabelSet` with a label for each point in the DataSeries (by means of a shared identifier). + + To classify a point, ``numNeighbours`` neighbours are determined for the incoming point, and each of those neighbours' label is given a score based on the distance to the target, neighbours with the same label only increase the likelyhood of that label being considered the nearest. The label with the highest score is considered to be the closest and returned. + + Keep in mind that this is a brute-force measure, so evaluation will become very slow for large numbers of points or long series. + +:control numNeighbours: + + The number of neighbours to consider + +:control constraint: + + The constraint to use in the `DTW` algorithm when calculating the distance between two time series. 'Warping' in this context means how distorted the genral shape of the series is. + For example, a pulse with a fast attack and slow decay will register as identical to the case with fast decay and slow attack, since stretching the time series can make it match in shape. If constraints are applied however, the amount of warping is restricted, so that the general shape of the series is kept. + + See https://rtavenar.github.io/blog/dtw.html#setting-additional-constraints for a beautiful visual explanation of the constraints + + :enum: + + :0: + **unconstrained** (any point can warp to any other) + + :1: + **ikatura** (the start and end can only warp a little, whereas the middle can warp more) + + :2: + **sakoe-chiba** (each point can only warp within a certain radius) + + +:control radius: + + The maximum radius a frame can warp away from its initial location when using a ``sakoe-chiba`` constraint. A higher value results in being able to warp more + + +:control gradient: + + Parameter for the ``ikatura`` constraint. A higher value results in being able to warp more. + + +:message cost: + + :arg dataSeries: Source :fluid-obj:`DataSeries` + + :arg id1: Identifier of the first series in the :fluid-obj:`DataSeries` + + :arg id2: Identifier of the second series in the :fluid-obj:`DataSeries` + + Return the cost, i.e. distance, between the series ``id1`` and ``id2`` in the ``dataSeries`` + + +:message bufcost: + + :arg buf1: |Buffer| with data for first series + + :arg buf2: |Buffer| with data for first series + + Return the cost, i.e. distance, between the buffers ``buf1`` and ``buf2`` From a03b930c01efbc83107e057eb88c70e83911c8ee Mon Sep 17 00:00:00 2001 From: lewardo Date: Sat, 9 Sep 2023 13:23:44 +0100 Subject: [PATCH 05/17] get correct name for message --- doc/DTW.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/DTW.rst b/doc/DTW.rst index 41a3832..359429e 100644 --- a/doc/DTW.rst +++ b/doc/DTW.rst @@ -57,7 +57,7 @@ Return the cost, i.e. distance, between the series ``id1`` and ``id2`` in the ``dataSeries`` -:message bufcost: +:message bufCost: :arg buf1: |Buffer| with data for first series From 02cce843f17dee62011fbfc5ab630637abcd749b Mon Sep 17 00:00:00 2001 From: lewardo Date: Sat, 9 Sep 2023 13:47:45 +0100 Subject: [PATCH 06/17] add `dataSeries` to paramdump --- include/FluidParameterDump.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/FluidParameterDump.hpp b/include/FluidParameterDump.hpp index 557a93b..c902ee7 100644 --- a/include/FluidParameterDump.hpp +++ b/include/FluidParameterDump.hpp @@ -260,6 +260,11 @@ std::string getArgType(SharedClientRef) return "DataSet"; } +std::string getArgType(SharedClientRef) +{ + return "DataSeries"; +} + std::string getArgType(SharedClientRef) { return "LabelSet"; @@ -270,6 +275,11 @@ std::string getArgType(SharedClientRef&) return "Input DataSet"; } +std::string getArgType(SharedClientRef) +{ + return "Input DataSeries"; +} + std::string getArgType(SharedClientRef&) { return "Input LabelSet"; From 246eb6243f0390f8a880c701df46eb2440d7353a Mon Sep 17 00:00:00 2001 From: lewardo Date: Sat, 9 Sep 2023 13:53:48 +0100 Subject: [PATCH 07/17] proper enum indentation --- doc/DTW.rst | 6 +++--- doc/DTWClassifier.rst | 6 +++--- doc/DTWRegressor.rst | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/DTW.rst b/doc/DTW.rst index 359429e..9c75a92 100644 --- a/doc/DTW.rst +++ b/doc/DTW.rst @@ -27,13 +27,13 @@ :enum: :0: - **unconstrained** (any point can warp to any other) + **unconstrained** (any point can warp to any other) :1: - **ikatura** (the start and end can only warp a little, whereas the middle can warp more) + **ikatura** (the start and end can only warp a little, whereas the middle can warp more) :2: - **sakoe-chiba** (each point can only warp within a certain radius) + **sakoe-chiba** (each point can only warp within a certain radius) :control radius: diff --git a/doc/DTWClassifier.rst b/doc/DTWClassifier.rst index 93db79c..08ec039 100644 --- a/doc/DTWClassifier.rst +++ b/doc/DTWClassifier.rst @@ -27,13 +27,13 @@ :enum: :0: - **unconstrained** (any point can warp to any other) + **unconstrained** (any point can warp to any other) :1: - **ikatura** (the start and end can only warp a little, whereas the middle can warp more) + **ikatura** (the start and end can only warp a little, whereas the middle can warp more) :2: - **sakoe-chiba** (each point can only warp within a certain radius) + **sakoe-chiba** (each point can only warp within a certain radius) :control radius: diff --git a/doc/DTWRegressor.rst b/doc/DTWRegressor.rst index e5d2879..50e749c 100644 --- a/doc/DTWRegressor.rst +++ b/doc/DTWRegressor.rst @@ -29,13 +29,13 @@ :enum: :0: - **unconstrained** (any point can warp to any other) + **unconstrained** (any point can warp to any other) :1: - **ikatura** (the start and end can only warp a little, whereas the middle can warp more) + **ikatura** (the start and end can only warp a little, whereas the middle can warp more) :2: - **sakoe-chiba** (each point can only warp within a certain radius) + **sakoe-chiba** (each point can only warp within a certain radius) :control radius: From 376a6a28408c75219eae5d94963f09206d4d6763 Mon Sep 17 00:00:00 2001 From: lewardo Date: Sat, 9 Sep 2023 14:40:38 +0100 Subject: [PATCH 08/17] acc give correct info --- doc/DTW.rst | 6 +++--- doc/DTWClassifier.rst | 5 ++--- doc/DTWRegressor.rst | 10 ++-------- doc/DataSeries.rst | 31 +++++-------------------------- include/FluidParameterDump.hpp | 11 +++++++++++ 5 files changed, 23 insertions(+), 40 deletions(-) diff --git a/doc/DTW.rst b/doc/DTW.rst index 9c75a92..daeb806 100644 --- a/doc/DTW.rst +++ b/doc/DTW.rst @@ -1,9 +1,9 @@ -:digest: Series Classification with K-Nearest Neighbours using Dynamic Time Warping +:digest: Series Distance Calculation using Dynamic Time Warping :species: data :sc-categories: Classification, DTW :sc-related: -:see-also: DTW, DataSeries, LabelSet -:description: A nearest neighbour classifier using a :fluid-obj:`DTW`. +:see-also: DataSeries +:description: Calculate the distance between two series using the dynamic time warping algorithm :discussion: diff --git a/doc/DTWClassifier.rst b/doc/DTWClassifier.rst index 08ec039..4604017 100644 --- a/doc/DTWClassifier.rst +++ b/doc/DTWClassifier.rst @@ -3,11 +3,10 @@ :sc-categories: Classification, DTW :sc-related: :see-also: DTW, DataSeries, LabelSet -:description: A nearest neighbour classifier using a :fluid-obj:`DTW`. - +:description: A nearest neighbour classifier using a :fluid-obj:`DTW` :discussion: - To keep with the interface of the :fluid-obj:`DTWClassifier`, the DTWClassifier must first be ``fit`` with a :fluid-obj:`DataSeries` of data points and a target :fluid-obj:`LabelSet` with a label for each point in the DataSeries (by means of a shared identifier). + To keep with the interface of the :fluid-obj:`KNNClassifier`, the DTWClassifier must first be ``fit`` with a :fluid-obj:`DataSeries` of data points and a target :fluid-obj:`LabelSet` with a label for each point in the DataSeries (by means of a shared identifier). To classify a point, ``numNeighbours`` neighbours are determined for the incoming point, and each of those neighbours' label is given a score based on the distance to the target, neighbours with the same label only increase the likelyhood of that label being considered the nearest. The label with the highest score is considered to be the closest and returned. diff --git a/doc/DTWRegressor.rst b/doc/DTWRegressor.rst index 50e749c..e19025c 100644 --- a/doc/DTWRegressor.rst +++ b/doc/DTWRegressor.rst @@ -3,11 +3,10 @@ :sc-categories: Regression, DTW :sc-related: :see-also: DTW, DataSeries, DataSet -:description: A nearest neighbour classifier using a :fluid-obj:`DTW`. - +:description: A nearest neighbour interpolator/regressor using a :fluid-obj:`DTW` :discussion: - To keep with the interface of the :fluid-obj:`DTWRegressor`, the DTWRegressor must first be ``fit`` with a :fluid-obj:`DataSeries` of data points and a target :fluid-obj:`DataSet` with a mapping for each point in the DataSeries (by means of a shared identifier). + To keep with the interface of the :fluid-obj:`KNNRegressor`, the DTWRegressor must first be ``fit`` with a :fluid-obj:`DataSeries` of data points and a target :fluid-obj:`DataSet` with a mapping for each point in the DataSeries (by means of a shared identifier). To calculate a point, ``numNeighbours`` neighbours are determined for the incoming point, and a distance-weighted sum of those neighbours' corresponding outputs is returned. @@ -42,12 +41,10 @@ The maximum radius a frame can warp away from its initial location when using a ``sakoe-chiba`` constraint. A higher value results in being able to warp more - :control gradient: Parameter for the ``ikatura`` constraint. A higher value results in being able to warp more. - :message fit: :arg dataSeries: Source :fluid-obj:`DataSeries` @@ -56,7 +53,6 @@ Fit the model to a source :fluid-obj:`DataSeries` and a target :fluid-obj:`LabelSet`. The labels in the :fluid-obj:`LabelSet` correspond to the data points in the :fluid-obj:`DataSeries` by means of a shared identifier. - :message predict: :arg dataSeries: A :fluid-obj:`DataSeries` of data series to predict labels for @@ -65,14 +61,12 @@ Given the fitted model, predict the output for a :fluid-obj:`DataSeries` and write these to a :fluid-obj:`DataSet` - :message predictPoint: :arg buffer: A data series stored in a |buffer| Given a fitted model, predict the output for a data point in |buffer| and return to the caller - :message clear: Clears the :fluid-obj:`DataSeries` and :fluid-obj:`LabelSet` diff --git a/doc/DataSeries.rst b/doc/DataSeries.rst index 108703a..45c49b9 100644 --- a/doc/DataSeries.rst +++ b/doc/DataSeries.rst @@ -2,16 +2,13 @@ :species: data :sc-categories: UGens>FluidManipulation :sc-related: Classes/Dictionary -:see-also: LabelSet, DataSet, DTW, +:see-also: LabelSet, DataSet, DTW :max-seealso: dict -:description: FluidDataSeries is a container associating series of data points with identifiers. - - +:description: FluidDataSeries is a container associating series of data points with identifiers :control name: The name of the FluidDataSeries. This is unique between all FluidDataSeries. - :message addFrame: :arg identifier: The identifier for the series to add to. @@ -20,7 +17,6 @@ Add a new frame to the end of a series, creates the series if it does not exist. Sets the dimensionality of the DataSeries if it is the first frame added, otherwise if the buffer is too short an error will be reported. - :message addSeries: :arg identifier: The identifier for the series to add. @@ -29,7 +25,6 @@ Add a new series from a buffer. Sets the dimensionality of the DataSeries if it is the first series added, otherwise if the buffer is too short an error will be reported. If the identifier already exists an error will be reported. - :message getFrame: :arg identifier: The identifier for the series to get from. @@ -40,7 +35,6 @@ Get a frame from a series. If the identifier doesn't exist or if that series doesnt have a frame for that time point an error will be reported. - :message getSeries: :arg identifier: The identifier for the series to get. @@ -49,7 +43,6 @@ Get a series. If the identifier doesn't exist an error will be reported. - :message setFrame: :arg identifier: The identifier for the series to set a frame in. @@ -60,7 +53,6 @@ Updates a time frame in a series, or adds it to the end if there is no frame at that time point. Sets the dimensionality of the DataSeries if it is the first frame added, otherwise if the buffer is too short an error will be reported. - :message setSeries: :arg identifier: The identifier for the series to set. @@ -69,7 +61,6 @@ Updates a time series, or adds it if it doesn't exist. Sets the dimensionality of the DataSeries if it is the first series added, otherwise if the buffer is too short an error will be reported. - :message updateFrame: :arg identifier: The identifier for the series to update a frame in. @@ -80,7 +71,6 @@ Updates an existing frame. If the buffer is too short an error will be reported. If the identifier doesn't exist or if that series doesnt have a frame for that time point an error will be reported. - :message updateSeries: :arg identifier: The identifier for the series to update. @@ -89,7 +79,6 @@ Updates a new series. If the buffer is too short an error will be reported. If the identifier doesn't exist an error will be reported. - :message deleteFrame: :arg identifier: The identifier for the series to delete a frame from. @@ -98,14 +87,12 @@ Delete a frame from a series, deletes the series if it is the last frame. If the identifier doesn't exist or if that series doesnt have a frame for that time point an error will be reported. - :message deleteSeries: :arg identifier: The identifier for the series to delete. Delete a series. If the identifier doesn't exist an error will be reported. - :message getDataSet: :arg dataSet: The Dataset to write the slice to. Will overwrite and resize. @@ -114,19 +101,16 @@ Get a dataset with the `time`th frame of every series, for examples create a :fluid-obj:`DataSet` with every first frame of every point. If an identifier doesn't have enough points it is merely not added to the output dataset. - :message clear: Empty the data series of all series and frames. - :message getIds: :arg labelSet: The FluidLabelSet to export to. Its content will be replaced. Export the dataset identifiers to a :fluid-obj:`LabelSet`. - :message merge: :arg sourceDataSet: The source DataSet to be merged. @@ -135,7 +119,6 @@ Merge sourceDataSeries in the current DataSeries. It will replace the value of points with the same identifier if overwrite is set to 1. - :message kNearest: :arg buffer: A |buffer| containing a data point to match against. @@ -144,7 +127,6 @@ Returns the identifiers of the ``k`` points nearest to the one passed in distance order (closest first). Note that this is a brute force distance measure, and inefficient for repeated queries against large dataseries. - :message kNearestDist: :arg buffer: A |buffer| containing a data point to match against. The number of frames in the buffer must match the dimensionality of the DataSet. @@ -153,29 +135,26 @@ Returns the distances to the ``k`` points nearest to the one passed in descending order. Note that this is a brute force distance measure, and inefficient for repeated queries against large dataseries. - :message print: Post an abbreviated content of the DataSeries in the window by default, but you can supply a custom action instead. - :message read: - :arg filename: (optional) filename to save to + :arg filename: optional, filename to save to Read a saved object in JSON format from disk, will prompt for file location if not filename not provided - :message write: - Save the contents of the object to a JSON file on disk to the file specified, will prompt for file location if not filename not provided + :arg filename: optional, filename to save to + Save the contents of the object to a JSON file on disk to the file specified, will prompt for file location if not filename not provided :message load: Load the state of this object from a Dictionary. - :message dump: Dump the state of this object as a Dictionary. diff --git a/include/FluidParameterDump.hpp b/include/FluidParameterDump.hpp index c902ee7..9627e6d 100644 --- a/include/FluidParameterDump.hpp +++ b/include/FluidParameterDump.hpp @@ -41,6 +41,10 @@ namespace dataset { class DataSetClient; } +namespace dataseries { +class DataSeriesClient; +} + namespace labelset { class LabelSetClient; } @@ -420,6 +424,13 @@ class ParameterDump { return "dataset"; } + + static std::string + getParamType(const SharedClientRef::ParamType&) + { + return "dataseries"; + } + static std::string getParamType(const SharedClientRef::ParamType&) { From 29481635eecf0c693a654cca383dbeba055e2c43 Mon Sep 17 00:00:00 2001 From: lewardo Date: Sat, 9 Sep 2023 14:41:36 +0100 Subject: [PATCH 09/17] why did I lose 2 hours over a siNgLE INdENT i hate rst --- doc/DTW.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/DTW.rst b/doc/DTW.rst index daeb806..523b0de 100644 --- a/doc/DTW.rst +++ b/doc/DTW.rst @@ -54,7 +54,7 @@ :arg id2: Identifier of the second series in the :fluid-obj:`DataSeries` - Return the cost, i.e. distance, between the series ``id1`` and ``id2`` in the ``dataSeries`` + Return the cost, i.e. distance, between the series ``id1`` and ``id2`` in the ``dataSeries`` :message bufCost: @@ -63,4 +63,4 @@ :arg buf2: |Buffer| with data for first series - Return the cost, i.e. distance, between the buffers ``buf1`` and ``buf2`` + Return the cost, i.e. distance, between the buffers ``buf1`` and ``buf2`` From 80475ea97fa36faed4c8fba792a7a03c03d56bac Mon Sep 17 00:00:00 2001 From: lewardo Date: Sat, 9 Sep 2023 18:44:53 +0100 Subject: [PATCH 10/17] clean up ref --- doc/DataSeries.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/DataSeries.rst b/doc/DataSeries.rst index 45c49b9..6d1f796 100644 --- a/doc/DataSeries.rst +++ b/doc/DataSeries.rst @@ -39,7 +39,7 @@ :arg identifier: The identifier for the series to get. - :arg buffer: A |buffer| containing the data for the series (each channel is a distinct time frame, will be resized). + :arg buffer: A |buffer| to write the series to (each channel is a distinct time frame, will be resized). Get a series. If the identifier doesn't exist an error will be reported. @@ -85,7 +85,7 @@ :arg time: which time frame to remove. - Delete a frame from a series, deletes the series if it is the last frame. If the identifier doesn't exist or if that series doesnt have a frame for that time point an error will be reported. + Delete a frame from a series, deletes the series if it is the only frame. If the identifier doesn't exist or if that series doesnt have a frame for that time point an error will be reported. :message deleteSeries: @@ -99,7 +99,7 @@ :arg time: which time frame to extract. - Get a dataset with the `time`th frame of every series, for examples create a :fluid-obj:`DataSet` with every first frame of every point. If an identifier doesn't have enough points it is merely not added to the output dataset. + Get a dataset with the `time`th frame of every series, i.e. can create a :fluid-obj:`DataSet` with every Nth frame of every series. If an identifier doesn't have enough frames it is merely not added to the output dataset. :message clear: @@ -109,11 +109,11 @@ :arg labelSet: The FluidLabelSet to export to. Its content will be replaced. - Export the dataset identifiers to a :fluid-obj:`LabelSet`. + Export the dataseries identifiers to a :fluid-obj:`LabelSet`. :message merge: - :arg sourceDataSet: The source DataSet to be merged. + :arg sourceDataSeries: The source DataSeries to be merged. :arg overwrite: A flag to allow overwrite points with the same identifier. From 6826e349a9553f6b062f34e9150204567a594dba Mon Sep 17 00:00:00 2001 From: lewardo Date: Sat, 9 Sep 2023 18:50:52 +0100 Subject: [PATCH 11/17] correct object names --- doc/DTWClassifier.rst | 2 +- doc/DTWRegressor.rst | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/doc/DTWClassifier.rst b/doc/DTWClassifier.rst index 4604017..8704b7b 100644 --- a/doc/DTWClassifier.rst +++ b/doc/DTWClassifier.rst @@ -48,7 +48,7 @@ :arg dataSeries: Source :fluid-obj:`DataSeries` - :arg labelSet: A :fluid-obj:`LabelSet` of labels for the source :fluid-obj:`DataSet` + :arg labelSet: A :fluid-obj:`LabelSet` of labels for the source :fluid-obj:`DataSeries` Fit the model to a source :fluid-obj:`DataSeries` and a target :fluid-obj:`LabelSet`. The labels in the :fluid-obj:`LabelSet` correspond to the data points in the :fluid-obj:`DataSeries` by means of a shared identifier. diff --git a/doc/DTWRegressor.rst b/doc/DTWRegressor.rst index e19025c..b056786 100644 --- a/doc/DTWRegressor.rst +++ b/doc/DTWRegressor.rst @@ -49,26 +49,28 @@ :arg dataSeries: Source :fluid-obj:`DataSeries` - :arg labelSet: A :fluid-obj:`LabelSet` of labels for the source :fluid-obj:`DataSet` + :arg dataSet: A :fluid-obj:`DataSet` of outputs for the source :fluid-obj:`DataSeries` - Fit the model to a source :fluid-obj:`DataSeries` and a target :fluid-obj:`LabelSet`. The labels in the :fluid-obj:`LabelSet` correspond to the data points in the :fluid-obj:`DataSeries` by means of a shared identifier. + Fit the model to a source :fluid-obj:`DataSeries` and a target :fluid-obj:`DataSet`. The outputs in the :fluid-obj:`DataSet` correspond to the data points in the :fluid-obj:`DataSeries` by means of a shared identifier. :message predict: - :arg dataSeries: A :fluid-obj:`DataSeries` of data series to predict labels for + :arg dataSeries: A :fluid-obj:`DataSeries` to predict regressions for - :arg labelSet: A :fluid-obj:`LabelSet` to write the predicted labels into + :arg dataSet: A :fluid-obj:`DataSet` to write the predicted outputs Given the fitted model, predict the output for a :fluid-obj:`DataSeries` and write these to a :fluid-obj:`DataSet` :message predictPoint: - :arg buffer: A data series stored in a |buffer| + :arg inBuffer: The input series stored in a |buffer| - Given a fitted model, predict the output for a data point in |buffer| and return to the caller + :arg outBuffer: A buffer to write the prediction to + + Given a fitted model, predict the output for a single series in and write it to another buffer :message clear: - Clears the :fluid-obj:`DataSeries` and :fluid-obj:`LabelSet` + Clears the :fluid-obj:`DataSeries` and :fluid-obj:`DataSet` From 2d6dc2e24258c13862cb32e8abc36831f8aa13a5 Mon Sep 17 00:00:00 2001 From: lewardo Date: Sun, 10 Sep 2023 11:58:50 +0100 Subject: [PATCH 12/17] update merged constraint params --- doc/DTW.rst | 9 ++------- doc/DTWClassifier.rst | 8 ++------ doc/DTWRegressor.rst | 8 ++------ 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/doc/DTW.rst b/doc/DTW.rst index 523b0de..da11da4 100644 --- a/doc/DTW.rst +++ b/doc/DTW.rst @@ -36,14 +36,9 @@ **sakoe-chiba** (each point can only warp within a certain radius) -:control radius: +:control constraintParam: - The maximum radius a frame can warp away from its initial location when using a ``sakoe-chiba`` constraint. A higher value results in being able to warp more - - -:control gradient: - - Parameter for the ``ikatura`` constraint. A higher value results in being able to warp more. + The maximum radius a frame can warp away from its initial location when using a ``sakoe-chiba`` constraint, and parameter for the ``ikatura`` constraint when using that. A higher value results in being able to warp more. See https://rtavenar.github.io/blog/dtw.html#setting-additional-constraints for an explanation of the significance. :message cost: diff --git a/doc/DTWClassifier.rst b/doc/DTWClassifier.rst index 8704b7b..362a64a 100644 --- a/doc/DTWClassifier.rst +++ b/doc/DTWClassifier.rst @@ -35,15 +35,11 @@ **sakoe-chiba** (each point can only warp within a certain radius) -:control radius: +:control constraintParam: - The maximum radius a frame can warp away from its initial location when using a ``sakoe-chiba`` constraint. A higher value results in being able to warp more + The maximum radius a frame can warp away from its initial location when using a ``sakoe-chiba`` constraint, and parameter for the ``ikatura`` constraint when using that. A higher value results in being able to warp more. See https://rtavenar.github.io/blog/dtw.html#setting-additional-constraints for an explanation of the significance. -:control gradient: - - Parameter for the ``ikatura`` constraint. A higher value results in being able to warp more. - :message fit: :arg dataSeries: Source :fluid-obj:`DataSeries` diff --git a/doc/DTWRegressor.rst b/doc/DTWRegressor.rst index b056786..ef191ee 100644 --- a/doc/DTWRegressor.rst +++ b/doc/DTWRegressor.rst @@ -37,13 +37,9 @@ **sakoe-chiba** (each point can only warp within a certain radius) -:control radius: +:control constraintParam: - The maximum radius a frame can warp away from its initial location when using a ``sakoe-chiba`` constraint. A higher value results in being able to warp more - -:control gradient: - - Parameter for the ``ikatura`` constraint. A higher value results in being able to warp more. + The maximum radius a frame can warp away from its initial location when using a ``sakoe-chiba`` constraint, and parameter for the ``ikatura`` constraint when using that. A higher value results in being able to warp more. See https://rtavenar.github.io/blog/dtw.html#setting-additional-constraints for an explanation of the significance. :message fit: From 60990cf7fed488ad8023ab5e8983dc7d3f3b1a4b Mon Sep 17 00:00:00 2001 From: lewardo Date: Sun, 10 Sep 2023 11:59:10 +0100 Subject: [PATCH 13/17] update getdataset argument order --- doc/DataSeries.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/DataSeries.rst b/doc/DataSeries.rst index 6d1f796..a8a64f6 100644 --- a/doc/DataSeries.rst +++ b/doc/DataSeries.rst @@ -95,10 +95,10 @@ :message getDataSet: - :arg dataSet: The Dataset to write the slice to. Will overwrite and resize. - :arg time: which time frame to extract. + :arg dataSet: The Dataset to write the slice to. Will overwrite and resize. + Get a dataset with the `time`th frame of every series, i.e. can create a :fluid-obj:`DataSet` with every Nth frame of every series. If an identifier doesn't have enough frames it is merely not added to the output dataset. :message clear: From 769127e5b86754af3aa091b7bbfe43219ce33f48 Mon Sep 17 00:00:00 2001 From: lewardo Date: Sun, 10 Sep 2023 12:15:20 +0100 Subject: [PATCH 14/17] document negative indexing --- doc/DataSeries.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/DataSeries.rst b/doc/DataSeries.rst index a8a64f6..a54bcef 100644 --- a/doc/DataSeries.rst +++ b/doc/DataSeries.rst @@ -33,7 +33,7 @@ :arg buffer: A |buffer| to write the frame to (only the first channel is used, will be resized). - Get a frame from a series. If the identifier doesn't exist or if that series doesnt have a frame for that time point an error will be reported. + Get a frame from a series. Negative indexing starts from the last frame. If the identifier doesn't exist or if that series doesnt have a frame for that time point an error will be reported. :message getSeries: @@ -51,7 +51,7 @@ :arg buffer: A |buffer| containing the data for the frame (only the first channel is used). - Updates a time frame in a series, or adds it to the end if there is no frame at that time point. Sets the dimensionality of the DataSeries if it is the first frame added, otherwise if the buffer is too short an error will be reported. + Updates a time frame in a series, or adds it to the end if there is no frame at that time point. Negative indexing starts from the last frame. Sets the dimensionality of the DataSeries if it is the first frame added, otherwise if the buffer is too short an error will be reported. :message setSeries: @@ -69,7 +69,7 @@ :arg buffer: A |buffer| containing the data for the frame (only the first channel is used). - Updates an existing frame. If the buffer is too short an error will be reported. If the identifier doesn't exist or if that series doesnt have a frame for that time point an error will be reported. + Updates an existing frame. Negative indexing starts from the last frame. If the buffer is too short an error will be reported. If the identifier doesn't exist or if that series doesnt have a frame for that time point an error will be reported. :message updateSeries: @@ -85,7 +85,7 @@ :arg time: which time frame to remove. - Delete a frame from a series, deletes the series if it is the only frame. If the identifier doesn't exist or if that series doesnt have a frame for that time point an error will be reported. + Delete a frame from a series, deletes the series if it is the only frame. Negative indexing starts from the last frame. If the identifier doesn't exist or if that series doesnt have a frame for that time point an error will be reported. :message deleteSeries: @@ -99,7 +99,7 @@ :arg dataSet: The Dataset to write the slice to. Will overwrite and resize. - Get a dataset with the `time`th frame of every series, i.e. can create a :fluid-obj:`DataSet` with every Nth frame of every series. If an identifier doesn't have enough frames it is merely not added to the output dataset. + Get a dataset with the `time`th frame of every series, i.e. can create a :fluid-obj:`DataSet` with every Nth frame of every series. Negative indexing starts from the last frame. If an identifier doesn't have enough frames it is merely not added to the output dataset. :message clear: From cd2fb04031d682095eb2a6a0cf8b8d5ae2d39ad7 Mon Sep 17 00:00:00 2001 From: tremblap Date: Sun, 24 Sep 2023 12:30:02 +0100 Subject: [PATCH 15/17] placeholder SC demo code --- example-code/sc/DTW.scd | 5 +++++ example-code/sc/DTWClassifier.scd | 5 +++++ example-code/sc/DTWRegressor.scd | 5 +++++ example-code/sc/DataSeries.scd | 5 +++++ 4 files changed, 20 insertions(+) create mode 100644 example-code/sc/DTW.scd create mode 100644 example-code/sc/DTWClassifier.scd create mode 100644 example-code/sc/DTWRegressor.scd create mode 100644 example-code/sc/DataSeries.scd diff --git a/example-code/sc/DTW.scd b/example-code/sc/DTW.scd new file mode 100644 index 0000000..211b722 --- /dev/null +++ b/example-code/sc/DTW.scd @@ -0,0 +1,5 @@ +code:: + +//soon + +:: \ No newline at end of file diff --git a/example-code/sc/DTWClassifier.scd b/example-code/sc/DTWClassifier.scd new file mode 100644 index 0000000..211b722 --- /dev/null +++ b/example-code/sc/DTWClassifier.scd @@ -0,0 +1,5 @@ +code:: + +//soon + +:: \ No newline at end of file diff --git a/example-code/sc/DTWRegressor.scd b/example-code/sc/DTWRegressor.scd new file mode 100644 index 0000000..211b722 --- /dev/null +++ b/example-code/sc/DTWRegressor.scd @@ -0,0 +1,5 @@ +code:: + +//soon + +:: \ No newline at end of file diff --git a/example-code/sc/DataSeries.scd b/example-code/sc/DataSeries.scd new file mode 100644 index 0000000..211b722 --- /dev/null +++ b/example-code/sc/DataSeries.scd @@ -0,0 +1,5 @@ +code:: + +//soon + +:: \ No newline at end of file From 584c0247aec65c9645b92f516f6d92b2ec599dac Mon Sep 17 00:00:00 2001 From: tremblap Date: Mon, 25 Sep 2023 13:47:47 +0100 Subject: [PATCH 16/17] modify the interface name - we predict from a buffer containing a Series, not a Point --- doc/DTWClassifier.rst | 10 +++++----- doc/DTWRegressor.rst | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/DTWClassifier.rst b/doc/DTWClassifier.rst index 362a64a..8e9a93b 100644 --- a/doc/DTWClassifier.rst +++ b/doc/DTWClassifier.rst @@ -6,11 +6,11 @@ :description: A nearest neighbour classifier using a :fluid-obj:`DTW` :discussion: - To keep with the interface of the :fluid-obj:`KNNClassifier`, the DTWClassifier must first be ``fit`` with a :fluid-obj:`DataSeries` of data points and a target :fluid-obj:`LabelSet` with a label for each point in the DataSeries (by means of a shared identifier). + To keep with the interface of the :fluid-obj:`KNNClassifier`, the DTWClassifier must first be ``fit`` with a :fluid-obj:`DataSeries` of data points and a target :fluid-obj:`LabelSet` with a label for each entry in the DataSeries (by means of a shared identifier). - To classify a point, ``numNeighbours`` neighbours are determined for the incoming point, and each of those neighbours' label is given a score based on the distance to the target, neighbours with the same label only increase the likelyhood of that label being considered the nearest. The label with the highest score is considered to be the closest and returned. + To classify a series, ``numNeighbours`` neighbours are determined for the incoming series, and each of those neighbours' label is given a score based on the distance to the target, neighbours with the same label only increase the likelyhood of that label being considered the nearest. The label with the highest score is considered to be the closest and returned. - Keep in mind that this is a brute-force measure, so evaluation will become very slow for large numbers of points or long series. + Keep in mind that this is a brute-force measure, so evaluation will become very slow for large numbers of series, or long series. :control numNeighbours: @@ -58,11 +58,11 @@ Given the fitted model, predict labels for a :fluid-obj:`DataSeries` and write these to a :fluid-obj:`LabelSet` -:message predictPoint: +:message predictSeries: :arg buffer: A data series stored in a |buffer| - Given a fitted model, predict a label for a data point in |buffer| and return to the caller + Given a fitted model, predict a label for a data series in |buffer| and return to the caller :message clear: diff --git a/doc/DTWRegressor.rst b/doc/DTWRegressor.rst index ef191ee..4b7bdd9 100644 --- a/doc/DTWRegressor.rst +++ b/doc/DTWRegressor.rst @@ -6,11 +6,11 @@ :description: A nearest neighbour interpolator/regressor using a :fluid-obj:`DTW` :discussion: - To keep with the interface of the :fluid-obj:`KNNRegressor`, the DTWRegressor must first be ``fit`` with a :fluid-obj:`DataSeries` of data points and a target :fluid-obj:`DataSet` with a mapping for each point in the DataSeries (by means of a shared identifier). + To keep with the interface of the :fluid-obj:`KNNRegressor`, the DTWRegressor must first be ``fit`` with a :fluid-obj:`DataSeries` of data points and a target :fluid-obj:`DataSet` with a mapping for each series in the DataSeries (by means of a shared identifier). - To calculate a point, ``numNeighbours`` neighbours are determined for the incoming point, and a distance-weighted sum of those neighbours' corresponding outputs is returned. + To calculate a point, ``numNeighbours`` neighbours are determined for the incoming series, and a distance-weighted sum of those neighbours' corresponding outputs is returned. - Keep in mind that this is a brute-force measure, so evaluation will become very slow for large numbers of points or long series. + Keep in mind that this is a brute-force measure, so evaluation will become very slow for large numbers of series or long series. See https://rtavenar.github.io/blog/dtw.html for an explanation of the DTW algorithm, though it can roughly be summed up as a metric measuring the similarity between two sime series, while accounting for the fact that features arent necessarily the same length. @@ -47,7 +47,7 @@ :arg dataSet: A :fluid-obj:`DataSet` of outputs for the source :fluid-obj:`DataSeries` - Fit the model to a source :fluid-obj:`DataSeries` and a target :fluid-obj:`DataSet`. The outputs in the :fluid-obj:`DataSet` correspond to the data points in the :fluid-obj:`DataSeries` by means of a shared identifier. + Fit the model to a source :fluid-obj:`DataSeries` and a target :fluid-obj:`DataSet`. The outputs in the :fluid-obj:`DataSet` correspond to the data series in the :fluid-obj:`DataSeries` by means of a shared identifier. :message predict: @@ -57,7 +57,7 @@ Given the fitted model, predict the output for a :fluid-obj:`DataSeries` and write these to a :fluid-obj:`DataSet` -:message predictPoint: +:message predictSeries: :arg inBuffer: The input series stored in a |buffer| From c174edf5da66d79a1beffbbe321fbcbd98334943 Mon Sep 17 00:00:00 2001 From: tremblap Date: Sun, 10 Mar 2024 12:29:03 +0000 Subject: [PATCH 17/17] DTW buffers now spelt as in the sc methods --- doc/DTW.rst | 6 +++--- doc/DTWRegressor.rst | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/DTW.rst b/doc/DTW.rst index da11da4..1772325 100644 --- a/doc/DTW.rst +++ b/doc/DTW.rst @@ -54,8 +54,8 @@ :message bufCost: - :arg buf1: |Buffer| with data for first series + :arg buffer1: |Buffer| with data for first series - :arg buf2: |Buffer| with data for first series + :arg buffer2: |Buffer| with data for first series - Return the cost, i.e. distance, between the buffers ``buf1`` and ``buf2`` + Return the cost, i.e. distance, between the buffers ``buffer1`` and ``buffer2`` diff --git a/doc/DTWRegressor.rst b/doc/DTWRegressor.rst index 4b7bdd9..a01382d 100644 --- a/doc/DTWRegressor.rst +++ b/doc/DTWRegressor.rst @@ -59,9 +59,9 @@ :message predictSeries: - :arg inBuffer: The input series stored in a |buffer| + :arg sourceBuffer: The input series stored in a |buffer| - :arg outBuffer: A buffer to write the prediction to + :arg targetBuffer: A buffer to write the prediction to Given a fitted model, predict the output for a single series in and write it to another buffer