Answers to questions

Answer to question 1: For this, you can invoke the saveModel() method by providing the input model filename:

String FILENAME = Constants.FILENAME;// Save the trained FM model fmlsgd.saveModel(FILENAME);

The saveModel() method goes as follows:

public void saveModel(String FILENAME) throws Exception    {        FILENAME = Constants.FILENAME;        FileOutputStream fos = null;        DataOutputStream dos = null;                try {                  fos = new FileOutputStream(FILENAME);            dos = new DataOutputStream(fos);            dos.writeBoolean(fm.k0);            dos.writeBoolean(fm.k1);            dos.writeDouble(fm.w0);            dos.writeInt(fm.num_factor);            dos.writeInt(fm.num_attribute);            dos.writeInt(task.ordinal());            dos.writeDouble(max_target);            dos.writeDouble(min_target);                        for(int i=0;i<fm.num_attribute;i++) ...

Get Java Deep Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.