keyunluo / python-ffm Goto Github PK
View Code? Open in Web Editor NEWPython Wrapped LibFFM
Python Wrapped LibFFM
IndexError Traceback (most recent call last)
in ()
----> 1 import ffm.ffm as ffm
~/比赛/Tencent/ffm/ffm/ffm.py in ()
3 import os
4 path = os.path.dirname(os.path.abspath(file))
----> 5 libffm_file = [i for i in os.listdir(path) if i.startswith('libffm.')][0]
6 lib_path = path + '/' + libffm_file
7
IndexError: list index out of range
[root@HW2288 python-ffm]# /usr/bin/python2.7
Python 2.7.14 | packaged by conda-forge | (default, Mar 30 2018, 18:16:04)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import ffm
return
No libffm.so Build!
my OS is Centos 7
import ffm
Traceback (most recent call last):
File "", line 1, in
File "/mnt/hgfs/VM_WorkFolder/software/python-ffm/ffm/init.py", line 1, in
from .ffm import FFMData, FFM, read_model
File "/mnt/hgfs/VM_WorkFolder/software/python-ffm/ffm/ffm.py", line 5, in
libffm_file = [i for i in os.listdir(path) if i.startswith('libffm.')][0]
IndexError: list index out of range
CentOS
in ffm.py
line:301 y_true = val_data.labels
=> y_true = [int(i) for i in val_data.labels]
on my machine print(set(y_true)) shows ['0','1'] while numpy could not recognize it as binary
[0,1] works
and add type cast in wrap_dataset would help reading data from texts :)
line: 105 node.f = int(f)
line: 106 node.j = int(j)
line: 107 node.v = float(v)
line: 119 d.label = float(y)
类FFMFormatPandas 中的transform方法中的
建议把 for _, row in tqdm(_df.iterrows(), total=len(_df)):
修改成
for row in tqdm(df.itertuples(),total= len(df)):
feature_tuple = []
for cat in self.categorical:
if pd.notnull(getattr(row, cat)):
feature_name = '{}_{}'.format(cat,getattr(row, cat))
ffm_value = (self.field_index[cat],self.feature_index[feature_name],1)
feature_tuple.append(ffm_value)
如果df 全部是数值型,在fit 的时候如果某个类别型的特征是int 型(如0),在transform的时候,通过 row[cat]来获取值的时候,会把int 型 转成float64类型(0->0.0),导致在feature_index中找不到key。
另外itertuples()应该比iterrows()快。
Traceback (most recent call last):
File "sklearn-example.py", line 7, in
from ffm import FFM, FFMFormatPandas, FFMData, save_data
File "/media/lx/项目/tx/python-ffm/ffm/init.py", line 1, in
from .ffm import *
File "/media/lx/项目/tx/python-ffm/ffm/ffm.py", line 5, in
libffm_file = [i for i in os.listdir(path) if i.startswith('libffm.')][0]
IndexError: list index out of range
Hi,
I some questions about installing,hoping you help me,
when I use command:"python3 setup.py install "
it shows as follows:
running install
running bdist_egg
running egg_info
writing ffm.egg-info/PKG-INFO
writing dependency_links to ffm.egg-info/dependency_links.txt
writing requirements to ffm.egg-info/requires.txt
writing top-level names to ffm.egg-info/top_level.txt
reading manifest file 'ffm.egg-info/SOURCES.txt'
writing manifest file 'ffm.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building 'ffm.libffm' extension
gcc -pthread -B /home/guo/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ilibffm -I/home/guo/anaconda3/include/python3.6m -c ffm/ffm-wrapper.cpp -o build/temp.linux-x86_64-3.6/ffm/ffm-wrapper.o -Wall -O3 -std=c++11 -march=native -DUSESSE -DDEBUG=0 -DLINUX
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from ffm/ffm-wrapper.cpp:48:0:
ffm/ffm-wrapper.h:8:17: fatal error: ffm.h: No such file or directory
#include "ffm.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
should I change code in ffm.h?
score predicted by this package is different from libffm, by the way the model used is trained by libffm.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.