Hi,
I could solve the before things.
But, I couldn't CRandomFourierDotFeatures.load_serializable() from the
> saved file by causing aborted.
>
Sorry, I found mistake point in my code. It works well.
Another considering point, I am concerned that the saved file becomes very
> big when serializing all parameters including feature (# of train feature's
> vectors may be over 1M).
>
I can resolve this by creating new CRandomFourierDotFeatures object for
saving random_coeff only.
Example:
file = new CSerializableAsciiFile(filename, 'w');
CRandomFourierDotFeatures *rs_features;
rs_features = new CRandomFourierDotFeatures(NULL, D,
KernelName::GAUSSIAN, params, w);
rs_features->save_serializable(rfile);
file->close();
SG_UNREF(file);
SG_UNREF(rs_features);
Thanks a lot !!
I appreciate the contribution of the all shogun developpers!!
Best,
Naoya
2018-02-15 23:25 GMT+09:00 Naoya Murakami <[email protected]>:
> Hi Viktor,
>
> Thanks for your very quick response.
>
> Oh i see.
>
> I tried to find how to save SGMatrix(SGMatrix does not inherit SGObject).
>
> I could confirm to save the random_coeff using
> Liblinear.save_serializable() after train and CRandomFourierDotFeatures.
> save_serializable().
>
> But, I couldn't CRandomFourierDotFeatures.load_serializable() from the
> saved file by causing aborted.
>
> After I check whether there is some other miss in my code, I will report
> if I get an error again.
>
> Another considering point, I am concerned that the saved file becomes
> very big when serializing all parameters including feature (# of train
> feature's vectors may be over 1M).
>
> Best,
> Naoya
>
>
> 2018-02-15 22:38 GMT+09:00 Viktor Gal <[email protected]>:
>
>> Hi,
>>
>> welcome to shogun!
>>
>> thanks for your bug reports, they are super useful!
>>
>> every object in shogun can be serialized with save_serializable and
>> loaded with load_serializable.
>> so for example if you do a CRandomFourierDotFeatures.save_serializable
>> that will serialize the random_coeff as well.
>>
>> but if for example you used in a model the CRandomFourierDotFeatures to
>> train, then when you call save_serializable on the model itself it should
>> serialize the CRandomFourierDotFeatures used for training, i.e. it will
>> automatically serialize the random_coeff, so when you load in the model
>> with load_serializable you should be able to do a a
>> LibLinear.get_features() that will return the CRandomFourierDotFeatures
>> that was serialized.
>>
>> cheers,
>> viktor
>>
>> > On 15 Feb 2018, at 1:32 PM, Naoya Murakami <
>> [email protected]> wrote:
>> >
>> > I have recently started using shogun as a c ++ library.
>> >
>> > Especially I would like to use Random Fourier Feature and Linear SVM
>> for building efficient classifier at first.
>> >
>> > I understand that Machine Class can be saved into a file by
>> save_serializable and read into the file by using load_serializable.
>> >
>> > However, for using the Random Fourier Feature, I think I have to save
>> and read random_coeff including random numbers.
>> >
>> > https://github.com/shogun-toolbox/shogun/blob/c0cb4a765a3dc9
>> 9fb3324d3e064049a2232ced85/applications/classification/
>> random_fourier_classification.cpp#L147
>> >
>> > How to save the random_coeff?
>> >
>> > It would be great if anyone can help me.
>> >
>> > Best,
>> > Naoya
>>
>>
>