From 95cce618c5cbed6a9cd598d8baad3d0ffe6160e9 Mon Sep 17 00:00:00 2001 From: Pierre Alexandre Tremblay Date: Thu, 21 May 2020 00:32:47 +0100 Subject: [PATCH] finished updating the basic files. --- .../Examples/dataset/super-simple-1D-example.scd | 5 +++-- .../Examples/dataset/super-simple-1D-example2.scd | 7 ++++--- release-packaging/HelpSource/Classes/FluidDataSet.schelp | 8 ++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/release-packaging/Examples/dataset/super-simple-1D-example.scd b/release-packaging/Examples/dataset/super-simple-1D-example.scd index 3e8d2b6..010477e 100644 --- a/release-packaging/Examples/dataset/super-simple-1D-example.scd +++ b/release-packaging/Examples/dataset/super-simple-1D-example.scd @@ -36,9 +36,9 @@ Routine{ ( Routine{ 10.do{|i| - ~point.set(0,i * 10); + ~point.set(0,i); s.sync; - ~kmeans.predictPoint(~point,{|x| ("Predicted Cluster for point" + (i * 10) ++ ":" + x).postln}) + ~kmeans.predictPoint(~point,{|x| ("Predicted Cluster for point" + i ++ ":" + x).postln}) } }.play ) @@ -53,6 +53,7 @@ Routine{ ~labels.size({|x| x.asInteger.do{|i| ~labels.getLabel(i.asString,action: {|l|("Label for" + i ++ ":" + l).postln}); + s.sync; };}); }.play ) diff --git a/release-packaging/Examples/dataset/super-simple-1D-example2.scd b/release-packaging/Examples/dataset/super-simple-1D-example2.scd index 5a22bb9..f42cdcc 100644 --- a/release-packaging/Examples/dataset/super-simple-1D-example2.scd +++ b/release-packaging/Examples/dataset/super-simple-1D-example2.scd @@ -39,9 +39,9 @@ Routine{ ( Routine{ 10.do{|i| - ~point.set(0,i * 10); + ~point.set(0,i); s.sync; - ~kmeans.predictPoint(~point,{|x| ("Predicted Cluster for point" + (i * 10) ++ ":" + x).postln}) + ~kmeans.predictPoint(~point,{|x| ("Predicted Cluster for point" + i ++ ":" + x).postln}) } }.play ) @@ -50,12 +50,13 @@ Routine{ ~kmeans.predict(~ds,~labels, {|x| ("Size of each cluster" + x).postln}) -s( +( Routine{ var n; ~labels.size({|x| x.asInteger.do{|i| ~labels.getLabel(i.asString,action: {|l|("Label for" + i ++ ":" + l).postln}); + s.sync; };}); }.play ) diff --git a/release-packaging/HelpSource/Classes/FluidDataSet.schelp b/release-packaging/HelpSource/Classes/FluidDataSet.schelp index 4a3733d..ec85964 100644 --- a/release-packaging/HelpSource/Classes/FluidDataSet.schelp +++ b/release-packaging/HelpSource/Classes/FluidDataSet.schelp @@ -105,6 +105,12 @@ ARGUMENT:: filename Absolute path for the new file ARGUMENT:: action A function to run when the file has been written + +METHOD:: dump +(buggy, please use Print for now) Post the content of the dataset in JSON format in the window by default, but you can supply a custom action instead; + +METHOD:: print +Post an abbreviated content of the dataset in the window by default, but you can supply a custom action instead; ​​ METHOD:: asString ​Responds with the name of the data set as a pretty(ish) string @@ -150,9 +156,11 @@ Routine{ ~ds.print //to post window by default, but you can supply a custom action instead ~ds.dump //likewise //for example +( ~ds.dump{|j| ~dict = j.parseJSON } +) //Now we have a Dictionary of our data and IDs ~dict.postcs