Knnregressor multiout (#153)

Amend `KNNRegressor` to multi-dimensional mapping
nix
tremblap 3 years ago committed by GitHub
parent c59b359023
commit 21c4311471
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -23,23 +23,27 @@ FluidKNNRegressor : FluidModelObject {
^this.prMakeMsg(\predict,this.id,sourceDataSet.id,targetDataSet.id) ^this.prMakeMsg(\predict,this.id,sourceDataSet.id,targetDataSet.id)
} }
predict{ |sourceDataSet, targetDataSet,action| predict{ |sourceDataSet, targetDataSet, action|
actions[\predict] = [nil, action]; actions[\predict] = [nil, action];
this.prSendMsg(this.predictMsg(sourceDataSet, targetDataSet)); this.prSendMsg(this.predictMsg(sourceDataSet, targetDataSet));
} }
predictPointMsg { |buffer| predictPointMsg { |sourceBuffer, targetBuffer|
^this.prMakeMsg(\predictPoint,id, this.prEncodeBuffer(buffer)); ^this.prMakeMsg(\predictPoint,id,
this.prEncodeBuffer(sourceBuffer),
this.prEncodeBuffer(targetBuffer),
["/b_query", targetBuffer.asUGenInput]);
} }
predictPoint { |buffer, action| predictPoint { |sourceBuffer, targetBuffer, action|
actions[\predictPoint] = [number(FluidMessageResponse,_,_),action]; actions[\predictPoint] = [nil,{action.value(targetBuffer)}];
this.prSendMsg(this.predictPointMsg(buffer)); this.predictPointMsg(sourceBuffer, targetBuffer);
this.prSendMsg(this.predictPointMsg(sourceBuffer, targetBuffer));
} }
kr{|trig, inputBuffer,outputBuffer| kr{|trig, inputBuffer, outputBuffer, numNeighbours, weight|
^FluidKNNRegressorQuery.kr(K2A.ar(trig), ^FluidKNNRegressorQuery.kr(K2A.ar(trig),
this, this.numNeighbours, this.weight, this, numNeighbours??{this.numNeighbours}, weight??{this.weight},
this.prEncodeBuffer(inputBuffer), this.prEncodeBuffer(inputBuffer),
this.prEncodeBuffer(outputBuffer)); this.prEncodeBuffer(outputBuffer));
} }

Loading…
Cancel
Save