Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with -save_model on Windows Running toy example #4

Closed
fedro86 opened this issue Feb 4, 2016 · 4 comments
Closed

Problem with -save_model on Windows Running toy example #4

fedro86 opened this issue Feb 4, 2016 · 4 comments

Comments

@fedro86
Copy link

fedro86 commented Feb 4, 2016

If I run the toy example:

 import pywFM
 import numpy as np
 import pandas as pd

 features = np.matrix([
 #     Users  |     Movies     |    Movie Ratings   | Time | Last Movies Rated
 #    A  B  C | TI  NH  SW  ST | TI   NH   SW   ST  |      | TI  NH  SW  ST
    [1, 0, 0,  1,  0,  0,  0,   0.3, 0.3, 0.3, 0,     13,   0,  0,  0,  0 ],
    [1, 0, 0,  0,  1,  0,  0,   0.3, 0.3, 0.3, 0,     14,   1,  0,  0,  0 ],
    [1, 0, 0,  0,  0,  1,  0,   0.3, 0.3, 0.3, 0,     16,   0,  1,  0,  0 ],
    [0, 1, 0,  0,  0,  1,  0,   0,   0,   0.5, 0.5,   5,    0,  0,  0,  0 ],
    [0, 1, 0,  0,  0,  0,  1,   0,   0,   0.5, 0.5,   8,    0,  0,  1,  0 ],
    [0, 0, 1,  1,  0,  0,  0,   0.5, 0,   0.5, 0,     9,    0,  0,  0,  0 ],
    [0, 0, 1,  0,  0,  1,  0,   0.5, 0,   0.5, 0,     12,   1,  0,  0,  0 ]
 ])
 target = [5, 3, 1, 4, 5, 1, 5]

 fm = pywFM.FM(task='regression', num_iter=5)

 model = fm.run(features[:5], target[:5], features[5:], target[5:])

I got this error

ERROR: the parameter save_model does not exist
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\FedRo\Anaconda\lib\site-packages\pywFM\__init__.py", line 231, in run
    rlog = pd.read_csv(rlog_path, sep='\t')
  File "C:\Users\FedRo\Anaconda\lib\site-packages\pandas\io\parsers.py", line 498, in parser_f
    return _read(filepath_or_buffer, kwds)
  File "C:\Users\FedRo\Anaconda\lib\site-packages\pandas\io\parsers.py", line 275, in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
  File "C:\Users\FedRo\Anaconda\lib\site-packages\pandas\io\parsers.py", line 590, in __init__
    self._make_engine(self.engine)
  File "C:\Users\FedRo\Anaconda\lib\site-packages\pandas\io\parsers.py", line 731, in _make_engine
    self._engine = CParserWrapper(self.f, **self.options)
  File "C:\Users\FedRo\Anaconda\lib\site-packages\pandas\io\parsers.py", line 1103, in __init__
    self._reader = _parser.TextReader(src, **kwds)
  File "pandas\parser.pyx", line 518, in pandas.parser.TextReader.__cinit__ (pandas\parser.c:5030)
ValueError: No columns to parse from file

so it looks like that -save_model doesn't work. My temporary solution is change lines 162 and 163 in __init__.py from:

                "-verbosity %d" % self.__verbose,
                "-save_model %s" % model_path]

to:

                "-verbosity %d" % self.__verbose]
                #"-save_model %s" % model_path]

The model starts working, you can use model prediction, but the model isn't saved.

@jfloff
Copy link
Owner

jfloff commented Feb 4, 2016

Did you compiled libfm from source, or have you used any of the installers available? The save_model operation appears in this commit which is from October 2015. The installers on libfm.org are from 2014 and the windows one from 2013.

@fedro86
Copy link
Author

fedro86 commented Feb 4, 2016

I tried both: windows executables and compiled libfm-1.42.src from source in cygwin with make and gcc.

@jfloff
Copy link
Owner

jfloff commented Feb 4, 2016

Both of them won't work. You have to clone the libfm repository and compile from there. Taken from the README:

git clone https://github.com/srendle/libfm /home/libfm
cd /home/libfm/ && make all

@fedro86
Copy link
Author

fedro86 commented Feb 4, 2016

I was just downloading it :) thank you

@fedro86 fedro86 closed this as completed Feb 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants