rookfighter / knn-cpp Goto Github PK
View Code? Open in Web Editor NEWA header-only C++ library for k nearest neighbor search with Eigen3.
License: MIT License
A header-only C++ library for k nearest neighbor search with Eigen3.
License: MIT License
I am getting multiple errors on compilation of kdtree_eigen.h
.
Some of the variables seem to have not been declared. These are the errors I get:
kdtree_eigen.h:196:42: error: ‘endIdx’ was not declared in this scope
for(Index i = startIdx; i <= endIdx; ++i)
kdtree_eigen.h:295:33: error: ‘currIndices’ was not declared in this scope
return new Node(currIndices);
kdtree_eigen.h:356:40: error: ‘midpoint’ was not declared in this scope
return new Node(splitaxis, midpoint, leftNode, rightNode);
kdtree_eigen.h:365:16: error: ‘currIndices’ was not declared in this scope
if(currIndices.size() <= bucketSize_)
Hello. I have tried to compile knn-cpp on mac and got the following error:
kdtree_minkowski_search.cpp:8:10: error: 'knncpp.h' file not found with <angled> include; use "quotes" instead
#include <knncpp.h>
^~~~~~~~~~
"knncpp.h"
In file included from kdtree_minkowski_search.cpp:8:
./knncpp.h:28:13: warning: 'typename' occurs outside of a template [-Wc++11-extensions]
typedef typename Eigen::MatrixXd::Index Index;
^~~~~~~~~
./knncpp.h:64:17: error: too many arguments provided to function-like macro invocation
"distance scalar and input matrix A must have same type");
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:930:13: note: macro 'static_assert' defined here
# define static_assert(__b, __m) _Static_assert(__b, __m)
^
In file included from kdtree_minkowski_search.cpp:8:
./knncpp.h:67:17: error: too many arguments provided to function-like macro invocation
"distance scalar and input matrix B must have same type");
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:930:13: note: macro 'static_assert' defined here
# define static_assert(__b, __m) _Static_assert(__b, __m)
^
In file included from kdtree_minkowski_search.cpp:8:
./knncpp.h:62:13: error: use of undeclared identifier 'static_assert'
static_assert(
^
./knncpp.h:65:13: error: use of undeclared identifier 'static_assert'
static_assert(
^
./knncpp.h:104:17: error: too many arguments provided to function-like macro invocation
"distance scalar and input matrix A must have same type");
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:930:13: note: macro 'static_assert' defined here
# define static_assert(__b, __m) _Static_assert(__b, __m)
^
In file included from kdtree_minkowski_search.cpp:8:
./knncpp.h:107:17: error: too many arguments provided to function-like macro invocation
"distance scalar and input matrix B must have same type");
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:930:13: note: macro 'static_assert' defined here
# define static_assert(__b, __m) _Static_assert(__b, __m)
^
In file included from kdtree_minkowski_search.cpp:8:
./knncpp.h:102:13: error: use of undeclared identifier 'static_assert'
static_assert(
^
./knncpp.h:105:13: error: use of undeclared identifier 'static_assert'
static_assert(
^
./knncpp.h:156:17: error: too many arguments provided to function-like macro invocation
"distance scalar and input matrix A must have same type");
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:930:13: note: macro 'static_assert' defined here
# define static_assert(__b, __m) _Static_assert(__b, __m)
^
In file included from kdtree_minkowski_search.cpp:8:
./knncpp.h:159:17: error: too many arguments provided to function-like macro invocation
"distance scalar and input matrix B must have same type");
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:930:13: note: macro 'static_assert' defined here
# define static_assert(__b, __m) _Static_assert(__b, __m)
^
In file included from kdtree_minkowski_search.cpp:8:
./knncpp.h:154:13: error: use of undeclared identifier 'static_assert'
static_assert(
^
./knncpp.h:157:13: error: use of undeclared identifier 'static_assert'
static_assert(
^
./knncpp.h:196:17: error: too many arguments provided to function-like macro invocation
"distance scalar and input matrix A must have same type");
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:930:13: note: macro 'static_assert' defined here
# define static_assert(__b, __m) _Static_assert(__b, __m)
^
In file included from kdtree_minkowski_search.cpp:8:
./knncpp.h:199:17: error: too many arguments provided to function-like macro invocation
"distance scalar and input matrix B must have same type");
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:930:13: note: macro 'static_assert' defined here
# define static_assert(__b, __m) _Static_assert(__b, __m)
^
In file included from kdtree_minkowski_search.cpp:8:
./knncpp.h:194:13: error: use of undeclared identifier 'static_assert'
static_assert(
^
./knncpp.h:197:13: error: use of undeclared identifier 'static_assert'
static_assert(
^
./knncpp.h:265:17: error: too many arguments provided to function-like macro invocation
"distance scalar and input matrix A must have same type");
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:930:13: note: macro 'static_assert' defined here
# define static_assert(__b, __m) _Static_assert(__b, __m)
^
In file included from kdtree_minkowski_search.cpp:8:
./knncpp.h:268:17: error: too many arguments provided to function-like macro invocation
"distance scalar and input matrix B must have same type");
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:930:13: note: macro 'static_assert' defined here
# define static_assert(__b, __m) _Static_assert(__b, __m)
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated
I have 2 classes and I want to see if the 60 points are one of these 2 classes. The problem is that I can’t get much data when I implement this algorithm with more than 1 nearest neighbor, cause I get a lot of -1 output otherwise.
please how can I use this algorithm with 2 classes and 60 points to be classified with k=7 without getting -1 in the output? Please can I iterate in the algorithm and adding points to the classes to be looked for as neighbors or the algorithm do that automatically?
On Windows/Visual Studio a long int does not size up to 64-bit (contrary to all *NIX flavors), but remains 32-bit. As a result, the typedef for Index (matrix.h:15) causes possible loss of precision warnings. Because (almost) everything of STL is using size_t, I would suggest to move to size_t, or if a signed index is wanted, ssize_t (or any other type that sizes with 32 and 64-bit mode of the compiler).
Unfortunately, Visual Studio does not have a typedef for ssize_t, but has SSIZE_T (uppercase). An alternative is also to use typedef long long int Index (which is platform independent). AFAIK long long never sizes to 128 bit :-)
Thanks.
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.