当前位置

网站首页> 程序设计 > 开源项目 > 编程语言 > 浏览文章

C++ 模版库 Tapkee

作者:小梦 来源: 网络 时间: 2024-05-19 阅读:

3月21日 深圳 OSC 源创会开始报名罗,送华为海思开发板

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 fromthe 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;}

相关阅读