libFM:无法加载/保存模型

时间:2018-09-19 09:24:00

标签: cygwin recommender-systems

我已经在cygwin上构建了libFM。exe,但是save_model / load_model似乎不起作用:

$ ./libFM.exe -task r -method als -train data.libfm1 -test test.libfm1 -iter 100 -dim ‘5,5,10’ -load_model mod -save_model mod -out res.txt
----------------------------------------------------------------------------
libFM
  Version: 1.4.4
  Author:  Steffen Rendle, srendle@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=532062 num_values=1064124      num_features=5548       min_target=4.88591e-05  max_target=2728.33
Loading test...
has x = 0
has xt = 1
num_rows=8828   num_values=17656        num_features=5548       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=843.76    Test=1818.09
#Iter=  1       Train=834.451   Test=1809.26
#Iter=  2       Train=828.697   Test=1804.68
#Iter=  3       Train=826.596   Test=1799.81
#Iter=  4       Train=825.624   Test=1797.39
#Iter=  5       Train=825.001   Test=1796.07
#Iter=  6       Train=824.561   Test=1795.28
#Iter=  7       Train=824.128   Test=1794.72
#Iter=  8       Train=823.628   Test=1794.32
#Iter=  9       Train=823.058   Test=1794.01
#Iter= 10       Train=822.35    Test=1793.77
#Iter= 11       Train=821.495   Test=1793.57
#Iter= 12       Train=820.475   Test=1793.4
#Iter= 13       Train=819.259   Test=1793.26
#Iter= 14       Train=817.804   Test=1793.12
#Iter= 15       Train=816.007   Test=1792.96
#Iter= 16       Train=813.778   Test=1792.78
#Iter= 17       Train=811.026   Test=1792.58
#Iter= 18       Train=807.526   Test=1792.35
#Iter= 19       Train=803.088   Test=1792.11
#Iter= 20       Train=797.588   Test=1791.79
#Iter= 21       Train=790.879   Test=1791.06
#Iter= 22       Train=782.458   Test=1789.96
#Iter= 23       Train=771.832   Test=1788.64
#Iter= 24       Train=758.433   Test=1787.18
#Iter= 25       Train=740.229   Test=1785.63
#Iter= 26       Train=718.402   Test=1783.97
#Iter= 27       Train=699.144   Test=1782.23
#Iter= 28       Train=677.813   Test=1780.37
#Iter= 29       Train=654.682   Test=1778.1
#Iter= 30       Train=627.238   Test=1774.78
#Iter= 31       Train=599.629   Test=1769.07
#Iter= 32       Train=561.1     Test=1761.65
#Iter= 33       Train=485.198   Test=1752.08
#Iter= 34       Train=389.219   Test=1738.76
#Iter= 35       Train=308.496   Test=1718.83
#Iter= 36       Train=244.646   Test=1694.29
#Iter= 37       Train=194.178   Test=1666.62
#Iter= 38       Train=154.331   Test=1636.97
#Iter= 39       Train=122.927   Test=1606.16
#Iter= 40       Train=98.2438   Test=1574.81
#Iter= 41       Train=78.9262   Test=1543.37
#Iter= 42       Train=63.9054   Test=1512.17
#Iter= 43       Train=52.3367   Test=1481.44
#Iter= 44       Train=43.5473   Test=1451.35
#Iter= 45       Train=36.9906   Test=1421.99
#Iter= 46       Train=32.2103   Test=1393.44
#Iter= 47       Train=28.8155   Test=1365.74
#Iter= 48       Train=26.4696   Test=1338.9
#Iter= 49       Train=24.8894   Test=1312.93
#Iter= 50       Train=23.848    Test=1287.82
#Iter= 51       Train=23.1733   Test=1263.55
#Iter= 52       Train=22.7416   Test=1240.1
#Iter= 53       Train=22.4679   Test=1217.44
#Iter= 54       Train=22.2956   Test=1195.55
#Iter= 55       Train=22.1876   Test=1174.4
#Iter= 56       Train=22.1198   Test=1153.95
#Iter= 57       Train=22.0776   Test=1134.18
#Iter= 58       Train=22.0514   Test=1115.06
#Iter= 59       Train=22.0353   Test=1096.56
#Iter= 60       Train=22.0254   Test=1078.65
#Iter= 61       Train=22.0193   Test=1061.31
#Iter= 62       Train=22.0138   Test=1044.51
#Iter= 63       Train=22.0078   Test=1028.23
#Iter= 64       Train=21.9998   Test=1012.45
#Iter= 65       Train=21.9904   Test=997.144
#Iter= 66       Train=21.9836   Test=982.29
#Iter= 67       Train=21.9793   Test=967.871
#Iter= 68       Train=21.9766   Test=953.868
#Iter= 69       Train=21.9749   Test=940.264
#Iter= 70       Train=21.9738   Test=927.041
#Iter= 71       Train=21.9731   Test=914.186
#Iter= 72       Train=21.9727   Test=901.681
#Iter= 73       Train=21.9725   Test=889.515
#Iter= 74       Train=21.9723   Test=877.672
#Iter= 75       Train=21.9722   Test=866.14
#Iter= 76       Train=21.9721   Test=854.908
#Iter= 77       Train=21.9721   Test=843.964
#Iter= 78       Train=21.9721   Test=833.297
#Iter= 79       Train=21.972    Test=822.896
#Iter= 80       Train=21.972    Test=812.752
#Iter= 81       Train=21.972    Test=802.855
#Iter= 82       Train=21.972    Test=793.197
#Iter= 83       Train=21.972    Test=783.768
#Iter= 84       Train=21.972    Test=774.562
#Iter= 85       Train=21.972    Test=765.569
#Iter= 86       Train=21.972    Test=756.783
#Iter= 87       Train=21.972    Test=748.197
#Iter= 88       Train=21.972    Test=739.804
#Iter= 89       Train=21.972    Test=731.597
#Iter= 90       Train=21.972    Test=723.571
#Iter= 91       Train=21.972    Test=715.719
#Iter= 92       Train=21.972    Test=708.036
#Iter= 93       Train=21.972    Test=700.516
#Iter= 94       Train=21.972    Test=693.155
#Iter= 95       Train=21.972    Test=685.947
#Iter= 96       Train=21.972    Test=678.888
#Iter= 97       Train=21.972    Test=671.972
#Iter= 98       Train=21.972    Test=665.197
#Iter= 99       Train=21.972    Test=658.557
Writing FM model to mod

文件mod到位并且包含一些数字(大多数为零)。 现在,我尝试再次启动它,希望它可以恢复,但是它是从头开始的:

$ ./libFM.exe -task r -method als -train data.libfm1 -test test.libfm1 -iter 100 -dim ‘5,5,10’ -load_model mod -save_model mod -out res.txt
----------------------------------------------------------------------------
libFM
  Version: 1.4.4
  Author:  Steffen Rendle, srendle@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=532062 num_values=1064124      num_features=5548       min_target=4.88591e-05  max_target=2728.33
Loading test...
has x = 0
has xt = 1
num_rows=8828   num_values=17656        num_features=5548       min_target=1   max_target=1
#relations: 0
Loading meta data...
Reading FM model...
#Iter=  0       Train=1242.26   Test=1239.97
#Iter=  1       Train=1239.28   Test=1236.05
#Iter=  2       Train=1238.53   Test=1232.92
#Iter=  3       Train=1283.05   Test=1237.22
#Iter=  4       Train=1245.98   Test=1242.34
#Iter=  5       Train=1143.14   Test=1242.26
#Iter=  6       Train=962.48    Test=1235.22
#Iter=  7       Train=787.968   Test=1220.46
#Iter=  8       Train=635.268   Test=1198.45
#Iter=  9       Train=505.948   Test=1165.38
#Iter= 10       Train=401.108   Test=1122.19
#Iter= 11       Train=318.007   Test=1074.38
#Iter= 12       Train=252.22    Test=1025.22
#Iter= 13       Train=200.194   Test=976.667
#Iter= 14       Train=159.102   Test=929.827
#Iter= 15       Train=126.703   Test=885.303
#Iter= 16       Train=101.225   Test=843.375
#Iter= 17       Train=81.27     Test=804.127
#Iter= 18       Train=65.7362   Test=767.526
#Iter= 19       Train=53.7528   Test=733.468
#Iter= 20       Train=44.6269   Test=701.809
#Iter= 21       Train=37.7977   Test=672.391
#Iter= 22       Train=32.7988   Test=645.047
#Iter= 23       Train=29.2325   Test=619.615
#Iter= 24       Train=26.7558   Test=595.939
#Iter= 25       Train=25.0793   Test=573.872
#Iter= 26       Train=23.969    Test=553.277
#Iter= 27       Train=23.2465   Test=534.03
#Iter= 28       Train=22.7824   Test=516.015
#Iter= 29       Train=22.487    Test=499.129
#Iter= 30       Train=22.3003   Test=483.277
#Iter= 31       Train=22.1824   Test=468.373
#Iter= 32       Train=22.1081   Test=454.339
#Iter= 33       Train=22.0599   Test=441.106
#Iter= 34       Train=22.0274   Test=428.61
#Iter= 35       Train=22.0068   Test=416.793
#Iter= 36       Train=21.9938   Test=405.603
#Iter= 37       Train=21.9857   Test=394.994
#Iter= 38       Train=21.9806   Test=384.921
#Iter= 39       Train=21.9774   Test=375.347
#Iter= 40       Train=21.9754   Test=366.236
#Iter= 41       Train=21.9741   Test=357.556
#Iter= 42       Train=21.9733   Test=349.277
#Iter= 43       Train=21.9728   Test=341.372
#Iter= 44       Train=21.9725   Test=333.818
#Iter= 45       Train=21.9723   Test=326.59
#Iter= 46       Train=21.9722   Test=319.669
#Iter= 47       Train=21.9721   Test=313.036
#Iter= 48       Train=21.9721   Test=306.674
#Iter= 49       Train=21.9721   Test=300.565
#Iter= 50       Train=21.972    Test=294.695
#Iter= 51       Train=21.972    Test=289.051
#Iter= 52       Train=21.972    Test=283.62
#Iter= 53       Train=21.972    Test=278.39
#Iter= 54       Train=21.972    Test=273.35
#Iter= 55       Train=21.972    Test=268.49
#Iter= 56       Train=21.972    Test=263.8
#Iter= 57       Train=21.972    Test=259.272
#Iter= 58       Train=21.972    Test=254.897
#Iter= 59       Train=21.972    Test=250.668
#Iter= 60       Train=21.972    Test=246.578
#Iter= 61       Train=21.972    Test=242.62
#Iter= 62       Train=21.972    Test=238.787
#Iter= 63       Train=21.972    Test=235.075
#Iter= 64       Train=21.972    Test=231.476
#Iter= 65       Train=21.972    Test=227.986
#Iter= 66       Train=21.972    Test=224.601
#Iter= 67       Train=21.972    Test=221.315
#Iter= 68       Train=21.972    Test=218.124
#Iter= 69       Train=21.972    Test=215.025
#Iter= 70       Train=21.972    Test=212.013
#Iter= 71       Train=21.972    Test=209.084
#Iter= 72       Train=21.972    Test=206.236
#Iter= 73       Train=21.972    Test=203.465
#Iter= 74       Train=21.972    Test=200.767
#Iter= 75       Train=21.972    Test=198.141
#Iter= 76       Train=21.972    Test=195.583
#Iter= 77       Train=21.972    Test=193.09
#Iter= 78       Train=21.972    Test=190.661
#Iter= 79       Train=21.972    Test=188.292
#Iter= 80       Train=21.972    Test=185.982
#Iter= 81       Train=21.972    Test=183.728
#Iter= 82       Train=21.972    Test=181.528
#Iter= 83       Train=21.972    Test=179.381
#Iter= 84       Train=21.972    Test=177.285
#Iter= 85       Train=21.972    Test=175.237
#Iter= 86       Train=21.972    Test=173.236
#Iter= 87       Train=21.972    Test=171.28
#Iter= 88       Train=21.972    Test=169.369
#Iter= 89       Train=21.972    Test=167.5
#Iter= 90       Train=21.972    Test=165.672
#Iter= 91       Train=21.972    Test=163.884
#Iter= 92       Train=21.972    Test=162.134
#Iter= 93       Train=21.972    Test=160.422
#Iter= 94       Train=21.972    Test=158.745
#Iter= 95       Train=21.972    Test=157.104
#Iter= 96       Train=21.972    Test=155.496
#Iter= 97       Train=21.972    Test=153.922
#Iter= 98       Train=21.972    Test=152.379
#Iter= 99       Train=21.972    Test=150.866
Writing FM model to mod

我尝试了来自github的两个存储库,但它们都无法正常运行。我想念什么?

1 个答案:

答案 0 :(得分:2)

您可以从github下载源代码然后进行构建。它的参数为-save_model,版本为1.4.4

但是,如果您从http://www.libfm.org/下载,其版本为1.4.2,而没有参数-save_model