O'Reilly logo

Java Deep Learning Projects by Md. Rezaul Karim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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++) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required