Might just be that I haven’t looked hard enough but I’m having trouble saving and restoring models created with the FluidMLPRegressor or FluidMLPClassifier in SuperCollider. The .write method seems to print the model to a file. I assumed I could restore the model with .read but got an error which refers to an ID, e.g. ‘ERROR: FluidMLPRegressor no instance with ID 4’. Am I on the right track here; is there any documentation on this that I have overlooked?
That sounds like an error I thought we got rid of in the last release. Does the following fail for you?
(
//just put anything into a dataset so we can 'fit' the MLP before writing
~ds = FluidDataSet(s);
~buf = Buffer.alloc(s,1,1);
~ds.setPoint(\1,~buf);
//mlp1 we'll fit then save
~mlp1 = FluidMLPRegressor(s);
~mlp1.fit(~ds,~ds);
~mlp1.write("/tmp/mlptest.json");
//read into a 2nd mlp
~mlp2 = FluidMLPRegressor(s);
~mlp2.read("/tmp/mlptest.json");
)
and does this work?
(
fork{
//just put anything into a dataset so we can 'fit' the MLP before writing
~ds = FluidDataSet(s);
s.sync;
~buf = Buffer.alloc(s,1,1);
~ds.setPoint(\1,~buf);
//mlp1 we'll fit then save
~mlp1 = FluidMLPRegressor(s);
s.sync;
~mlp1.fit(~ds,~ds);
~mlp1.write("/tmp/mlptest.json");
//read into a 2nd mlp
~mlp2 = FluidMLPRegressor(s);
s.sync;
~mlp2.read("/tmp/mlptest.json");
}
)
If so, maybe an update is indicated. If you do
FluidDataSet.version
it should print your version to the console: current is version 1.0.0-TB2.beta5
Hi Owen!
Thanks a lot for this. Yes I did get errors in the first block of code but not the second. Also turns out I have version 1.0.0-TB2.beta4 so I need to update. However, I did get it to work by creating the instance first and then calling .read, rather than doing it all in one line.