jfloff / pywFM

pywFM is a Python wrapper for Steffen Rendle's factorization machines library libFM
https://pypi.python.org/pypi/pywFM
MIT License
250 stars 43 forks source link

how do I run on windows? #26

Closed freepose closed 6 years ago

freepose commented 6 years ago

see title. anaconda3

jfloff commented 6 years ago

Did you had any problems running?

freepose commented 6 years ago

Can't install. VC link error.

jfloff commented 6 years ago

Is it pywFM specific or something else? Can you be post the error?

freepose commented 6 years ago

Thanks for the reply. the path error. C:\libfmlibFM -> C:\libfm\libFM

C:\libfmlibFM -task r -train C:\Users\freepose\AppData\Local\Temp\tmpzwbvgpz5 -test C:\Users\freepose\AppData\Local\Temp\tmpvi5z303h -dim '1,1,8' -init_stdev 0.1 -iter 5 -method mcmc -out C:\Users\freepose\AppData\Local\Temp\tmpkf6xo9si -verbosity 0 -save_model C:\Users\freepose\AppData\Local\Temp\tmp_ut9e2b0 -rlog C:\Users\freepose\AppData\Local\Temp\tmpxs95f65x

jfloff commented 6 years ago

This shouldn't be the case since we recently had a PR that fixed this. But you can fix this by editing your LIBFM_PATH var, and adding a '/' at the end.

freepose commented 6 years ago

Thanks for your suggestions.

  1. LIBFM_PATH var has been added a suffix: '\'.
  2. The pywFM has been run up.
  3. Another problem is: could the sparse vector (input format of libsvm) be used as the input format of pywFM?

best regards

jfloff commented 6 years ago

Regarding 3. pywFM is a python wrapper for libFM. libFM uses the sparse vector, so if you intend to use that input format, I recommend you to use libFM directly.

Closing the issue. Thank you for you feedback!

freepose commented 6 years ago

Thanks many much!

imenyani commented 1 year ago

Hello, I am trying to run the pywFM code example on Windows 10 in a Jupyter Notebook environment, but I'm encountering an error. Can someone help me find a solution for this error?

import pywFM import numpy as np import pandas as pd import os

os.environ['LIBFM_PATH'] = r"C:\Users\test\AppData\Local\Programs\Python\Python311\Lib\site-packages\pywFM\libfm"

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] features = np.asarray(features) fm = pywFM.FM(task='regression', num_iter=5)

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

The error message I'm encountering is: File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\pandas_libs\parsers.pyx:555, in pandas._libs.parsers.TextReader.cinit() EmptyDataError: No columns to parse from file

I would appreciate any assistance in resolving this issue.