Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/flucoma/clients/nrt/DataSetClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ namespace dataset {

constexpr auto DataSetReadParams = defineParameters(
InputDataSetClientRef::makeParam("dataSet", "DataSet Name"),
LongParam("numNeighbours", "Number of Nearest Neighbours", 1),
LongParam("numNeighbours", "Number of Nearest Neighbours", 1, Min(1)),
InputDataSetClientRef::makeParam("lookupDataSet", "Lookup DataSet Name"),
InputBufferParam("inputPointBuffer", "Input Point Buffer"),
BufferParam("predictionBuffer", "Prediction Buffer"));
Expand Down
9 changes: 7 additions & 2 deletions include/flucoma/clients/nrt/KDTreeClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace kdtree {

constexpr auto KDTreeParams = defineParameters(
StringParam<Fixed<true>>("name", "Name"),
LongParam("numNeighbours", "Number of Nearest Neighbours", 1),
LongParam("numNeighbours", "Number of Nearest Neighbours", 1, Min(0)),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it Min(0) here and Min(1) in DataSet?

FloatParam("radius", "Maximum distance", 0, Min(0)));

class KDTreeClient : public FluidBaseClient,
Expand Down Expand Up @@ -79,6 +79,8 @@ class KDTreeClient : public FluidBaseClient,
Optional<index> nNeighbours) const
{
index k = nNeighbours ? nNeighbours.value() : get<kNumNeighbors>();

if (k < 0) return Error(SmallK);

auto reply = computeKnearest(data, k);
if (!reply.ok()) return reply;
Expand All @@ -98,6 +100,9 @@ class KDTreeClient : public FluidBaseClient,
Optional<index> nNeighbours) const
{
index k = nNeighbours ? nNeighbours.value() : get<kNumNeighbors>();

if (k < 0) return Error(SmallK);

auto reply = computeKnearest(data, k);
if (!reply.ok()) return reply;

Expand Down Expand Up @@ -149,7 +154,7 @@ using KDTreeRef = SharedClientRef<const KDTreeClient>;

constexpr auto KDTreeQueryParams = defineParameters(
KDTreeRef::makeParam("tree", "KDTree"),
LongParam("numNeighbours", "Number of Nearest Neighbours", 1),
LongParam("numNeighbours", "Number of Nearest Neighbours", 1, Min(0)),
FloatParam("radius", "Maximum distance", 0, Min(0)),
InputDataSetClientRef::makeParam("lookupDataSet", "Lookup DataSet Name"),
InputBufferParam("inputPointBuffer", "Input Point Buffer"),
Expand Down
Loading