Error when loading models..

135 views
Skip to first unread message

tro...@fodi.se

unread,
Sep 11, 2017, 9:59:54 AM9/11/17
to libFM - Factorization Machines
Hi all. I am trying to use -save_model and -load_model but it does not work. I initialise the model with

libfm -iter 30 -method als -train /.../FM_approach/fromRtolibFM_train.txt -test /.../FM_approach/fromRtolibFM_test.txt -out /.../FM_approach/output.txt -save_model /.../FM_approach/model1 -task c

and everything seems to work well;

libFM
Version: 1.4.4
Author: Steffen Rendle, sre...@libfm.org
WWW: http://www.libfm.org/
This program comes with ABSOLUTELY NO WARRANTY; for details see license.txt.
This is free software, and you are welcome to redistribute it under certain
conditions; for details see license.txt.
----------------------------------------------------------------------------
Loading train...
has x = 0
has xt = 1
num_rows=900878 num_values=14197204 num_features=47820 min_target=-1 max_target=1
Loading test...
has x = 0
has xt = 1
num_rows=225220 num_values=3538540 num_features=47820 min_target=-1 max_target=1
#relations: 0
Loading meta data...
#Iter= 0 Train=0.959307 Test=0.922409 Test(ll)=0.117882
#Iter= 1 Train=0.979366 Test=0.937523 Test(ll)=0.101397
...
#Iter= 29 Train=0.99973 Test=0.982999 Test(ll)=0.0346611
Writing FM model to /.../FM_approach/model1

But then when I try to load the model using

libfm -iter 1 -method als -train /.../FM_approach/fromRtolibFM_train.txt -test /.../FM_approach/fromRtolibFM_newtest.txt -out /.../FM_approach/output2.txt -load_model /.../FM_approach/model1 -task c

it gives me error

----------------------------------------------------------------------------
libFM
Version: 1.4.4
Author: Steffen Rendle, sre...@libfm.org
WWW: http://www.libfm.org/
This program comes with ABSOLUTELY NO WARRANTY; for details see license.txt.
This is free software, and you are welcome to redistribute it under certain
conditions; for details see license.txt.
----------------------------------------------------------------------------
Loading train...
has x = 0
has xt = 1
num_rows=900878 num_values=14197204 num_features=47820 min_target=-1 max_target=1
Loading test...
has x = 0
has xt = 1
num_rows=22660 num_values=203940 num_features=49867 min_target=1 max_target=1
#relations: 0
Loading meta data...
Reading FM model...
WARNING: malformed model file. Nothing will be loaded.
#Iter= 0 Train=0.961256 Test=0.200971 Test(ll)=0.48077


Any idea what I am doing wrong and/or what I can do to fix it?

Thanks in advance

Message has been deleted

tro...@fodi.se

unread,
Sep 12, 2017, 3:15:25 AM9/12/17
to libFM - Factorization Machines
I found the issue, my new testset had more features than my training/old test set due to an error in the code when constructing the new testset.

郭梦卓

unread,
Jul 25, 2019, 5:34:20 AM7/25/19
to libFM - Factorization Machines
Hi, can you send me a latest windows verision of FM that can use '-save_model' to output the model parameters?


在 2017年9月11日星期一 UTC+8下午9:59:54,tro...@fodi.se写道:
Reply all
Reply to author
Forward
0 new messages