MLPACKC++ 的機(jī)器學(xué)習(xí)庫(kù)
mlpack 是一個(gè)C++的機(jī)器學(xué)習(xí)庫(kù),它重點(diǎn)在于其擴(kuò)展性、高速性和易用性。它的目的是讓新用戶通過(guò)簡(jiǎn)單、一致的API使用機(jī)器學(xué)習(xí),同時(shí)為專業(yè)用戶提供C++的高性能和最大靈活性。他的性能超出大量類似的機(jī)器學(xué)習(xí)庫(kù),如WEKA、Shogun、MATLAB、mlpy及sklearn,這一對(duì)比工作可以參考文獻(xiàn)[1]。
mlpack含有豐富的文檔和教程,可以參考項(xiàng)目主頁(yè)。教程中包含的算法有:近鄰搜索(NeighborSearch)、范圍搜索(RangeSearch)、線性回歸(LinearRegression)、歐幾里德最小生成樹(shù)(The Euclidean Minimum Spanning Tree)、K-均值(K-Means)、FastMKS(Fast max-kernel search)等。
mlpack提供了大量的類或API供程序調(diào)用,同時(shí)還提供了很多可執(zhí)行程序供不懂C++的用戶使用。這些可執(zhí)行文件包括:allkfn, allknn, emst, gmm, hmm_train, hmm_loglik, hmm_viterbi, hmm_generate, kernel_pca, kmeans, lars, linear_regression, local_coordinate_coding, mvu, nbc, nca, pca, radical, sparse_coding。
示例代碼:
#include<mlpack/methods/range_search/range_search.hpp>using namespace mlpack::range; // Our dataset matrix, which is column-major. extern arma::mat dataset; // The 'true' option indicates that we will use naive calculation. RangeSearch<> a(dataset, true); // The vector-of-vector objects we will store output in. std::vector> resultingNeighbors; std::vector> resultingDistances; // The range we will use. The upper bound is DBL_MAX. math::Range r(5.0, DBL_MAX); // [5.0, inf). a.Search(r, resultingNeighbors, resultingDistances);
評(píng)論
圖片
表情
