It seems to have two questions:
1. store data.
C2 has webstorage to save string into browser. Or FileSaver plugin can save data into a file.
2. logic about machine learning.
Since you already has a "plutronic" plugin for this purpose. The only thing is to export string (or a binary) data out.