forum.alglib.net
http://forum.alglib.net/

Serialization in 3.x
http://forum.alglib.net/viewtopic.php?f=2&t=128
Page 1 of 1

Author:  aitrader [ Tue Nov 23, 2010 10:18 am ]
Post subject:  Serialization in 3.x

I just began porting code over to Alglib 3.1 and can't find the serialization interface for logit . Has this code been written? If so, what are the new routines called?

If not is it relatively trivial to lift over the old 2.x serialization code and modify it for use with 3.1?

Author:  Sergey.Bochkanov [ Tue Nov 23, 2010 2:44 pm ]
Post subject:  Re: Serialization in 3.x

ALGLIB 3.x does not include serialization code yet. It wasn't ported from 2.x because of plans to introduce new, better serialization facilities (both functionality and implementation will change) in the beginning of 2011. So I had to choose between backward incompatibility when porting from 2.6 to 3.0 and incompatibility when porting from 3.x to 3.(x+1).

Luckily, in most cases you can store ALGLIB object without serialization interface. As for logit, you can use mnlunpack() function to access its coefficients.

Author:  Sergey.Bochkanov [ Tue Nov 23, 2010 2:48 pm ]
Post subject:  Re: Serialization in 3.x

Quote:
If not is it relatively trivial to lift over the old 2.x serialization code and modify it for use with 3.1?

Yes, you can port it with only slight changes. There are two problems:
* internal representation of arrays in 3.x is different from that of 2.x, so you have to modify code which reads/writes object fields
* in 3.x almost all fields are hidden, private
But both these problems are solvable. As for data analysis package, nothing was changed in the internals, so you can leave "pack-unpack" logic unchanged.

Author:  Kir [ Fri Jul 08, 2016 8:40 pm ]
Post subject:  Re: Serialization in 3.x

Hello, Sergey!

I am sorry for my stupid question but I did not find out clear explanation of one issue...
I trained a Neural networks ensemble with function alglib::mlpetraines(). Next I made serialization of the ensemble. Do I need to call the function alglib::mlpecreatec1() (that I called before alglib::mlpetraines()) before calling function alglib::mlpeunserialize() or not ?

Code:
alglib::mlpecreate1(nin, nhid, nout, ensemblesize, ensemble_A);
alglib::mlpetraines(ensemble_A, XY_set, npoints, decay, restarts, info, rep);
alglib::mlpeserialize( ensemble_A, string_mem );
...
...
...
version 1:
alglib::mlpecreate1(nin, nhid, nout, ensemblesize, ensemble_B);
alglib::mlpeunserialize( string_mem, ensemble_B);
alglib::mlpeprocess(ensemble_B, x_Vector, y_Out);

version 2:
alglib::mlpeunserialize( string_mem, ensemble_B);
alglib::mlpeprocess(ensemble_B, x_Vector, y_Out);

Which version of the code is right, 1 or 2 ?
Thank you in advance.

Author:  Sergey.Bochkanov [ Mon Jul 11, 2016 8:39 am ]
Post subject:  Re: Serialization in 3.x

version 2 is correct. Version 1 will work too, but mlpeunserialize() will overwrite target network anyway, so 2 is better.

Author:  Kir [ Mon Jul 11, 2016 8:02 pm ]
Post subject:  Re: Serialization in 3.x

Thank you very much for your reply!

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/