lyst / rpforest Goto Github PK
View Code? Open in Web Editor NEWIt is a forest of random projection trees
License: Apache License 2.0
It is a forest of random projection trees
License: Apache License 2.0
Referencing https://github.com/lyst/rpforest/blob/master/rpforest/rpforest.py#L59
The tree already exists, so is there a way to handle this gracefully instead of raising an error?
I'm not sure if the implementation already supports this, but is it possible assign a label with every point with fit(), so when there is a query, I can identify the neighbors by the labels?
In win7 environment, when i install rpforest ,i met the problem. i use vs2015.
the complie error informatios:
C:\Users\juine\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python
\9.0\VC\Bin\cl.exe /c logo /Ox /MD /W3 /GS- /DNDEBUG -ID:\Python27\lib\site-p
ackages\numpy\core\include -ID:\Python27\include -ID:\Python27\PC /Tprpforest/rp
forest_fast.cpp /Fobuild\temp.win32-2.7\Release\rpforest/rpforest_fast.obj -ffas
t-math
cl : Command line warning D9002 : ignoring unknown option '-ffast-math'
rpforest_fast.cpp
d:\python27\lib\site-packages\numpy\core\include\numpy\npy_1_7_deprecated_ap
i.h(12) : Warning Msg: Using deprecated NumPy API, disable it by #defining NPY_N
O_DEPRECATED_API NPY_1_7_API_VERSION
rpforest/rpforest_fast.cpp(271) : fatal error C1083: Cannot open include fil
e: 'stdint.h': No such file or directory
error: command 'C:\Users\juine\AppData\Local\Programs\Common\Microsof
t\Visual C++ for Python\9.0\VC\Bin\cl.exe' failed with exit status 2
OS/compiler details:
OS X version: 10.11.2 (El Capitan)
$ clang --version
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posix
gcc
is an alias for clang
.
Installing rpforest in a fresh virtualenv environment works fine:
$ mkvirtualenv rpfenv
... python 3.4 env built ...
(rpfenv)$ pip install numpy
... numpy 1.10.2 installed ...
(rpfenv)$ pip install rpforest
... rpforest 1.1 installed ...
rpforest_fast was compiled successfully with:
clang -Wno-unused-result -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/dsc/.virtualenvs/rpfenv/lib/python3.4/site-packages/numpy/core/include -I/usr/local/Cellar/python3/3.4.3_2/Frameworks/Python.framework/Versions/3.4/include/python3.4m -c rpforest/rpforest_fast.cpp -o build/temp.macosx-10.10-x86_64-3.4/rpforest/rpforest_fast.o -std=c++11
Trying to do the same in a conda environment results in compilation errors however:
$ conda create -n rpfenv2 python=3.4
... python 3.4 env built ...
$ source activate rpfenv2
(rpfenv2)$ pip install numpy
... numpy 1.10.2 installed ...
(rpfenv2)$ pip install rpforest
rpforest 1.1 is downloaded, but compilation fails. Compilation command:
clang -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/dsc/miniconda3/envs/rpfenv2/include -arch x86_64 -I/Users/dsc/miniconda3/envs/rpfenv2/lib/python3.4/site-packages/numpy/core/include -I/Users/dsc/miniconda3/envs/rpfenv2/include/python3.4m -c rpforest/rpforest_fast.cpp -o build/temp.macosx-10.5-x86_64-3.4/rpforest/rpforest_fast.o -std=c++11
Compiler errors:
In file included from rpforest/rpforest_fast.cpp:271:
In file included from /Users/dsc/miniconda3/envs/rpfenv2/lib/python3.4/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Users/dsc/miniconda3/envs/rpfenv2/lib/python3.4/site-packages/numpy/core/include/numpy/ndarrayobject.h:18:
In file included from /Users/dsc/miniconda3/envs/rpfenv2/lib/python3.4/site-packages/numpy/core/include/numpy/ndarraytypes.h:1781:
/Users/dsc/miniconda3/envs/rpfenv2/lib/python3.4/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by " \
^
rpforest/rpforest_fast.cpp:5727:28: error: no member named 'shrink_to_fit' in 'std::vector<int, std::allocator<int> >'
__pyx_v_node->indices->shrink_to_fit();
~~~~~~~~~~~~~~~~~~~~~ ^
rpforest/rpforest_fast.cpp:5940:28: error: no member named 'shrink_to_fit' in 'std::vector<int, std::allocator<int> >'
__pyx_v_node->indices->shrink_to_fit();
~~~~~~~~~~~~~~~~~~~~~ ^
1 warning and 2 errors generated.
error: command 'clang' failed with exit status 1
In file included from rpforest/rpforest_fast.cpp:271:
In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17:
In file included from /usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1804:
/usr/local/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by " \
^
rpforest/rpforest_fast.cpp:5727:28: error: no member named 'shrink_to_fit' in 'std::vector<int, std::allocator<int> >'
__pyx_v_node->indices->shrink_to_fit();
~~~~~~~~~~~~~~~~~~~~~ ^
rpforest/rpforest_fast.cpp:5940:28: error: no member named 'shrink_to_fit' in 'std::vector<int, std::allocator<int> >'
__pyx_v_node->indices->shrink_to_fit();
~~~~~~~~~~~~~~~~~~~~~ ^
1 warning and 2 errors generated.
error: command 'gcc' failed with exit status 1
Hello,
I'm trying to fir an rpforet module on a big matrix (3000000 x 300) in python 3.5 on OS X 10.11 and I get the following error:
Traceback (most recent call last):
File "rpforest_test.py", line 29, in <module>
index.fit(model.syn0)
File "/usr/local/lib/python3.5/site-packages/rpforest/rpforest.py", line 81, in fit
tree.make_tree(self._X)
File "rpforest/rpforest_fast.pyx", line 237, in rpforest.rpforest_fast.Tree.make_tree (rpforest/rpforest_fast.cpp:3896)
ValueError: Buffer dtype mismatch, expected 'double' but got 'float'
hi, @maciejkula ,
According to your paper titled "Metadata Embeddings for User and Item Cold-start Recommendations", lyst generate recommendation using lightfm and some kind of ANN algorithm. So I came to rpforest in lyst's repository and I think maybe that's exactly the ANN.
Now Suppose that we have trained a lightfm model, include embeddings and bias. It seems that it is still hard to rapidly generate top-k recommendation using rpforest, Since as Readme said, rpforest is based on cosine similarity, however, the score for a user-item pair in lightfm is the sum of a dot product of two embeddings and two bias.
So my question is:
Is rpforest supports custom similarity/distance function, or some other way can achieve top-k recommendation?
thanks
jianyi
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.