Shark – Machine Learning

Shark is a fast, modular, feature-rich open-source C++ machine learning library.

It provides methods for linear and nonlinear optimization, kernel-based learning algorithms, neural networks, and various other machine learning techniques. It serves as a powerful toolbox for real world applications as well as for research. Shark works on Windows, MacOS X, and Linux. It comes with extensive documentation. Shark is licensed under the GNU Lesser General Public License.

News

Shark 4.0 Released

Juni 9, 2018: We are happy to announce the official release of Shark 4.0.0

Shark 3.1 Released

March 1, 2016: We are happy to announce the official release of Shark 3.1.0.

Shark 3.0 Released

October 27, 2015: We are happy to announce the official release of Shark 3.0.0.

Shark moves to GitHub

October 9, 2015: Shark moved to GitHub. Please update your repositories, see the downloads page for more details.

Shark goes LGPL

As of January 2014, Shark is distributed under the permissive GNU Lesser General Public License.

Downloads

The current stable version is Shark 4.0, released 9-6-2018.

Shark 4 is largely incompatible with earlier versions of Shark. We have made interfaces cleaner and support now computation with floating point precision. There is also experimental support for GPU compations which is expanded in future minor releases.

Source Packages

We have two source packages available:
    Shark-4.0.0.zip     Shark-4.0.0.tar.gz

Shark Repository

Get the current Shark repository snapshot:

git clone https://github.com/Shark-ML/Shark/

OS coverage status service
Linux and Mac OSlibrary and unit tests build results Linux and Mac OS travis-ci
Windowslibrary only, no unit tests build results Windows appveyor

Quick Start

Let's demonstrate basic use of Shark with very few lines of code. This is C++, so we start with includes.

#include <shark/Data/Download.h> #include <shark/Algorithms/Trainers/LDA.h> #include <shark/ObjectiveFunctions/Loss/ZeroOneLoss.h> using namespace shark;

Let's load some data for learning.

ClassificationDataset traindata; downloadCsvData(traindata, "www.shark-ml.org/data/quickstart-train.csv", LAST_COLUMN, ' ');

The next step is to create a predictive model. Here we use a simple linear classifier.

LinearClassifier<> classifier;

The core step of learning is to train the model on data using a trainer. In Shark, the trainer is not glued to the model. Instead it is a separate object. Here, good old Linear Discriminant Analysis (LDA) suits our needs.

LDA lda; lda.train(classifier, traindata);

Congrats! We have a readily trained classifier. Let's try it out by applying it to new data.

ClassificationDataset testdata; downloadCsvData(testdata, "www.shark-ml.org/data/quickstart-test.csv", LAST_COLUMN, ' '); ZeroOneLoss<> loss; double error = loss(testdata.labels(), classifier(testdata.inputs()));

Further reading:

Why Shark?

Speed and flexibility

Shark provides an excellent trade-off between flexibility and ease-of-use on the one hand, and computational efficiency on the other.

One for all

Shark offers numerous algorithms from various machine learning and computational intelligence domains in a way that they can be easily combined and extended.

Unique features

Shark comes with a lot of powerful algorithms that are to our best knowledge not implemented in any other library, for example in the domains of model selection and training of binary and multi-class SVMs, or evolutionary single- and multi-objective optimization.

Credits and Copyright

Citing Shark

We kindly ask you to cite Shark in academic work as:

Christian Igel, Verena Heidrich-Meisner, and Tobias Glasmachers. Shark. Journal of Machine Learning Research 9, pp. 993-996, 2008.

The article's bibtex entry reads:

@Article{shark08,
  author = {Christian Igel and Verena Heidrich-Meisner and Tobias Glasmachers},
  title = {Shark},
  journal = {Journal of Machine Learning Research},
  year = {2008},
  volume = {9},
  pages = {993--996}
}

License

The Shark library is made available under the GNU Lesser General Public License.

Hosting institutions

The Shark machine learning library is jointly maintained by researchers from