corrected the example patches of tb2

nix
Pierre Alexandre Tremblay 6 years ago
parent d138471955
commit 1823737c76

@ -1,7 +1,6 @@
( (
// set some variables // set some variables
~nb_of_dim = 10; ~nb_of_dim = 10;
~dataset.clear;
~dataset = FluidDataSet(s,\test,~nb_of_dim); ~dataset = FluidDataSet(s,\test,~nb_of_dim);
) )
@ -17,6 +16,8 @@
}); });
) )
~dataset.print;
// make a buf for getting points back // make a buf for getting points back
~query_buf = Buffer.alloc(s,~nb_of_dim); ~query_buf = Buffer.alloc(s,~nb_of_dim);

@ -9,26 +9,29 @@ n = 200
// creates the dataset with these associated indices and values // creates the dataset with these associated indices and values
( (
~simpleInput = FluidDataSet(s,\simpleInput,1); ~simpleInput = FluidDataSet(s,\simpleInput);
~simpleOutput = FluidDataSet(s,\simpleOutput,1); ~simpleOutput = FluidDataSet(s,\simpleOutput);
b = Buffer.alloc(s,1,1); b = Buffer.alloc(s,1,1);
~mappingviz = Buffer.alloc(s,512); ~mappingviz = Buffer.alloc(s,512);
) )
( (
Routine{ Routine{
n.do{|i| n.do{|i|
b.set(0,~idx[i]); b.set(0,~idx[i]);
s.sync; ~simpleInput.addPoint(i.asString,b,{("Added Input" + i).postln});
~simpleInput.addPoint(i.asString,b,{("Added Input" + i).postln}); s.sync;
b.set(0,~data[i]); b.set(0,~data[i]);
s.sync; ~simpleOutput.addPoint(i.asString,b,{("Added Output" + i).postln});
~simpleOutput.addPoint(i.asString,b,{("Added Output" + i).postln}); s.sync;
~mappingviz.set((~idx[i]/61).asInt,~data[i]) ~mappingviz.set((~idx[i]/61).asInteger,~data[i])
} }
}.play }.play
) )
~simpleInput.print
~simpleOutput.print
//look at the seeing material //look at the seeing material
~mappingviz.plot(minval:-1,maxval:1) ~mappingviz.plot(minval:-1,maxval:1)
@ -45,7 +48,6 @@ k = 1; // change to see how many points the system uses to regress
Routine{ Routine{
512.do{|i| 512.do{|i|
b.set(0,i*61); b.set(0,i*61);
s.sync;
~knn.predictPoint(b,k,action:{|d|~mappingresult.set(i,d);}); ~knn.predictPoint(b,k,action:{|d|~mappingresult.set(i,d);});
s.sync; s.sync;
i.postln; i.postln;
@ -55,9 +57,3 @@ Routine{
// look at the interpolated values // look at the interpolated values
~mappingresult.plot ~mappingresult.plot
// clears both datasets
(
~simpleInput.clear;
~simpleOutput.clear;
)

Loading…
Cancel
Save