Machine Learning in C++

SHARK

Used in: Regression tasks

Installation:

sudo apt-get install cmake cmake-curses-gui libatlas-base-dev libboost-all-dev# Download package
mkdir build
cd build
cmake ..
make -j

Headers:

#include <shark/ObjectiveFunctions/Loss/SquaredLoss.h>
#include <shark/Algorithms/Trainers/LinearRegression.h>

Compile:

-std=c++11 -lboost_serialization -lshark -lcblas

MLPACK

Used in: Clustering tasks

Installation:

apt-get install libboost-math-dev libboost-program-options-dev libboost-test-dev libboost-serialization-dev libarmadillo-dev binutils-devsudo apt-get install libmlpack-dev
(or)
sudo apt-get install mlpack-bin

Headers:

#include <mlpack/methods/kmeans/kmeans.hpp>
#include <armadillo>

Compile:

std=c++11 -larmadillo -lmlpack -lboost_serialization

DLIB

Used in: Clustering and lot more algorithms

Installation:

Download dlib source

mkdir build
cd build
cmake ..
cmake -build . --config Release

Headers:

#include <dlib/clustering.h>
#include <dlib/rand.h>

Compile:

g++ -I /home/admin/Programs/dlib-19.7/ /home/admin/Programs/dlib-19.7/dlib/all/source.cpp -lpthread -lX11

OPENCV

Used in: Image processing

Installation:

sudo apt-get install build-essentialsudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-devsudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libc1394-22-devgit clone https://github.com/opencv/opencv.git
cd ~/opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j8
sudo make install

Header:

#include "opencv2/objdetect.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"

Compile:

pkg-config --libs --cflags opencv
(or)
compile using cmake

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store