您的位置:首页 > 运维架构 > Linux

Shark machine learning library在linux下的安装

2015-10-02 12:31 821 查看

Shark machine learning library在linux下的安装

    Shark 是一个快速、模块化、功能丰富的开源 C++ 机器学习库,提供了各种机器学习相关技术,比如线性/非线性优化、基于内核学习算法、神经网络等。Shark 已经应用于多个现实项目中。

 Shark 依赖于 Boost 和 CMake,其源码基于 GPLv3协议,兼容 Windows、Solaris、MacOSX 和 Linux 平台。

详细信息:http://image.diku.dk/shark/sphinx_pages/build/html/index.html

一.安装前准备的工具

1.1 Boost的安装

最简单的方法:

apt-cache search boost       搜到所有的boost库

然后:

sudo apt-get install libboost-all-dev   安装相应的库 

    详细参考:http://blog.csdn.net/simtwo/article/details/8083598

1.2 CMake的安装

终端输入:sudo apt-get install cmake  

二.Shark安装

2.1 下载Shark

使用TortoiseSVN工具下载最新版本:

svn co https://svn.code.sf.net/p/shark-project/code/trunk/Shark

2.2 编译安装Shark

使用终端依次执行以下命令:

mkdir Shark/build/        //在Shark创建build文件夹

cd Shark/build

cmake ../

make          //此过程需要比较的时间

最后执行:make install 

详细参考:http://image.diku.dk/shark/sphinx_pages/build/html/rest_sources/getting_started/installation.html

 

三.Shark测试

使用shark自带的一个例子Statistics.cpp

 

#include <shark/Statistics/Statistics.h>

#include <shark/Rng/GlobalRng.h>

using namespace shark;

int main(int argc, char** argv)

{

Statistics stats;

 

// Sample 10000 standard normally distributed random numbers

// and update statistics for these numbers iteratively.

for (std::size_t i = 0; i < 100000; i++)

stats( Rng::gauss() );

 

// Output results to the console.

std::cout << stats << std::endl;

 

std::cout << 

stats( Statistics::NumSamples() ) << " " <<

stats( Statistics::Min() ) << " " <<

stats( Statistics::Max() ) << " " <<

stats( Statistics::Mean() ) << " " << 

stats( Statistics::Variance() ) << " " <<

stats( Statistics::Median() ) << " " <<

stats( Statistics::LowerQuartile() ) << " " <<

stats( Statistics::UpperQuartile() ) << std::endl;

}

使用编译器(如g++)编译成功即说明已成功安装了Shark。

 

 

 

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  机器学习 shark