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 homepage moved

May 21, 2024: The Shark homepage moved to https://shark-ml.github.io/Shark

Shark updates and future releases

May 21, 2024: We made some updates to Shark, and if you you clone the repository, it should work nicely. You might call this Shark 4.1.0, however, we will not do official Shark releases anymore. We will try to maintain the current status of the library. Please simply checkout the most recent versions from the GitHub repository.

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

Shark Repository

Get the current Shark repository snapshot:

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

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, "https://raw.githubusercontent.com/Shark-ML/Shark/master/docs/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, "https://raw.githubusercontent.com/Shark-ML/Shark/master/docs/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