Tapkee 是一个 C++ 模版库,提供了降维操作功能。The Tapkee origins from the code developed during GSoC 2011 as the part of the Shogun machine learning toolbox. The project aim is to provide efficient and flexible standalone library for dimensionality reduction which can be easily integrated to existing codebases. Tapkee leverages capabilities of effective Eigen3 linear algebra library and optionally makes use of the ARPACK eigensolver. The library uses CoverTree and VP-tree data structures to compute nearest neighbors. To achieve greater flexibility we provide a callback interface which decouples dimension reduction algorithms from the data representation and storage schemes.
一个最简单的示例:
#include <tapkee/tapkee.hpp> #include <tapkee/callbacks/dummy_callbacks.hpp> using namespace std; using namespace tapkee; struct MyDistanceCallback { ScalarType distance(IndexType l, IndexType r) { return abs(l-r); } }; int main(int argc, const char** argv) { const int N = 100; vector<IndexType> indices(N); for (int i=0; i<N; i++) indices[i] = i; MyDistanceCallback d; TapkeeOutput output = tapkee::initialize() .withParameters((method=MultidimensionalScaling,target_dimension=1)) .withDistance(d) .embedUsing(indices); cout << output.embedding.transpose() << endl; return 0; }