本文首发于个人博客https://kezunlin.me/post/1cd6a04d/,欢迎阅读最新内容!tutorial to compile and install mplack on ubuntu 16.04Guidemlpack: a scalable C++ machine learning librarydependenciesArmadil...

本文首发于个人博客https://kezunlin.me/post/1cd6a04d/,欢迎阅读最新内容!
tutorial to compile and install mplack on ubuntu 16.04
Guide
mlpack: a scalable C++ machine learning library
dependencies
- Armadillo >= 6.500.0
- Boost
- CMake >= 3.3.2
Armadillo: c++ linear algebra library based on
LAPACK
andBLAS
If you are compiling Armadillo by hand, ensure that LAPACK and BLAS are enabled.
see OpenCV vs. Armadillo vs. Eigen on Linux
sudo apt-get install libarmadillo-dev
install
apt-get
sudo apt-get install libmlpack-dev
version: 2.0.1
by defaultmlpack
will install to/usr/include/mlpack
and/usr/lib
compile
wget https://www.mlpack.org/files/mlpack-3.1.1.tar.gz
git clone https://github.com/mlpack/mlpack.git
mkdir build && cd build && cmake-gui ..
make -j8
sudo make install
configure and output
...
Found Armadillo: /usr/lib/libarmadillo.so (found suitable version "6.500.5", minimum required is "6.500.0")
Armadillo libraries: /usr/lib/libarmadillo.so
...
version: 3.1.1
by defaultmlpack
will install to/usr/local/include
and/usr/local/lib/libmlpack.so.3.1
usage
mlpack-config.cmake
#.rst:
# FindMLPACK
# -------------
#
# Find MLPACK
#
# Find the MLPACK C++ library
#
# Using MLPACK::
#
# find_package(MLPACK REQUIRED)
# include_directories(${MLPACK_INCLUDE_DIRS})
# add_executable(foo foo.cc)
# target_link_libraries(foo ${MLPACK_LIBRARIES})
#
# This module sets the following variables::
#
# MLPACK_FOUND - set to true if the library is found
# MLPACK_INCLUDE_DIRS - list of required include directories
# MLPACK_LIBRARIES - list of libraries to be linked
# MLPACK_VERSION_MAJOR - major version number
# MLPACK_VERSION_MINOR - minor version number
# MLPACK_VERSION_PATCH - patch version number
# MLPACK_VERSION_STRING - version number as a string (ex: "1.0.4")
# UNIX paths are standard, no need to specify them.
find_library(MLPACK_LIBRARY
NAMES mlpack
PATHS "$ENV{ProgramFiles}/mlpack/lib" "$ENV{ProgramFiles}/mlpack/lib64" "$ENV{ProgramFiles}/mlpack"
)
find_path(MLPACK_INCLUDE_DIR
NAMES mlpack/core.hpp mlpack/prereqs.hpp
PATHS "$ENV{ProgramFiles}/mlpack"
)
if(MLPACK_INCLUDE_DIR)
# Read and parse mlpack version header file for version number
file(STRINGS "${MLPACK_INCLUDE_DIR}/mlpack/core/util/version.hpp" _mlpack_HEADER_CONTENTS REGEX "#define MLPACK_VERSION_[A-Z]+ ")
string(REGEX REPLACE ".*#define MLPACK_VERSION_MAJOR ([0-9]+).*" "\\1" MLPACK_VERSION_MAJOR "${_mlpack_HEADER_CONTENTS}")
string(REGEX REPLACE ".*#define MLPACK_VERSION_MINOR ([0-9]+).*" "\\1" MLPACK_VERSION_MINOR "${_mlpack_HEADER_CONTENTS}")
string(REGEX REPLACE ".*#define MLPACK_VERSION_PATCH ([0-9]+).*" "\\1" MLPACK_VERSION_PATCH "${_mlpack_HEADER_CONTENTS}")
unset(_mlpack_HEADER_CONTENTS)
set(MLPACK_VERSION_STRING "${MLPACK_VERSION_MAJOR}.${MLPACK_VERSION_MINOR}.${MLPACK_VERSION_PATCH}")
endif()
find_package_handle_standard_args(MLPACK
REQUIRED_VARS MLPACK_LIBRARY MLPACK_INCLUDE_DIR
VERSION_VAR MLPACK_VERSION_STRING
)
if(MLPACK_FOUND)
set(MLPACK_INCLUDE_DIRS ${MLPACK_INCLUDE_DIR})
set(MLPACK_LIBRARIES ${MLPACK_LIBRARY})
endif()
# Hide internal variables
mark_as_advanced(
MLPACK_INCLUDE_DIR
MLPACK_LIBRARY
)
From here
CMakeLists.txt
find_package(MLPACK REQUIRED)
MESSAGE( [Main] " MLPACK_INCLUDE_DIRS = ${MLPACK_INCLUDE_DIRS}")
MESSAGE( [Main] " MLPACK_LIBRARIES = ${MLPACK_LIBRARIES}")
# /usr/local/include
# /usr/local/lib/libmlpack.so
mlpack clustering
see mlpack clustering
kmeans
skip now.
meanshift
mlpack_meanshift doc
mlpack mean shift test
dbscan
- mlpack dbscan test
sklearn clustering
from sklearn.cluster import MeanShift
from sklearn.cluster import DBSCAN
from sklearn.cluster import KMeans
see sklearn clustering
opencv clustering
- cv::kmeans()
see opencv clustering
Reference
- mlpack
- mlpack.org
- mlpack findpackage
- mlpack mean shift
- dlib
History
- 20190520: created.
Copyright
- Post author: kezunlin
- Post link: https://kezunlin.me/post/1cd6a04d/
- Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 3.0 unless stating additionally.
本文标题为:ubuntu 16.04 上编译和安装C++机器学习工具包mlpack并编写mlpack-config.cmake | tutorial to compile and install mplack o


基础教程推荐
- C语言预编译#define(预处理) 2023-04-03
- 使用C/C++读写.mat文件的方法详解 2023-03-05
- 如何告诉 MinGW 链接器不要导出所有符号? 2022-10-07
- C++类和对象到底是什么 2022-11-12
- 使用VS2022开发在线远程编译部署的C++程序(图文详解) 2023-01-15
- 漫画讲解C语言中最近公共祖先的三种类型 2023-01-01
- C语言文件操作与相关函数介绍 2023-06-13
- C/C++ Qt StatusBar底部状态栏应用教程 2023-01-10
- C++高级数据结构之并查集 2023-04-20
- C语言实现简易停车场管理系统 2023-03-13