Is it possible to use libsvm in cuda? - machine-learning

I wonder If I can use libsvm in cuda.
I look for best parameters by cross validation, so I have to run same code around 4000 with different parameters.
I wonder If I can run the cross validation in parallel with cuda,
instead of using:
for i in range(4000):
predict(parameter)
find_best_parameter()

In the official webpage of the libsvm software you can find this sentence:
Python, R, MATLAB, Perl, Ruby, Weka, Common LISP, CLISP, Haskell, OCaml, LabVIEW, and PHP interfaces. C# .NET code and CUDA extension is available.
And there is a link to a GPU implementation:
http://mklab.iti.gr/project/GPU-LIBSVM

Related

Is there a native library written in Julia for Machine Learning?

I have started using Julia.I read that it is faster than C.
So far I have seen some libraries like KNET and Flux, but both are for Deep Learning.
also there is a command "Pycall" tu use Python inside Julia.
But I am interested in Machine Learning too. So I would like to use SVM, Random Forest, KNN, XGBoost, etc but in Julia.
Is there a native library written in Julia for Machine Learning?
Thank you
A lot of algorithms are just plain available using dedicated packages. Like BayesNets.jl
For "classical machine learning" MLJ.jl which is a pure Julia Machine Learning framework, it's written by the Alan Turing Institute with very active development.
For Neural Networks Flux.jl is the way to go in Julia. Also very active, GPU-ready and allow all the exotics combinations that exist in the Julia ecosystem like DiffEqFlux.jl a package that combines Flux.jl and DifferentialEquations.jl.
Just wait for Zygote.jl a source-to-source automatic differentiation package that will be some sort of backend for Flux.jl
Of course, if you're more confident with Python ML tools you still have TensorFlow.jl and ScikitLearn.jl, but OP asked for pure Julia packages and those are just Julia wrappers of Python packages.
Have a look at this kNN implementation and this for XGboost.
There are SVM implementations, but outdated an unmaintained (search for SVM .jl). But, really, think about other algorithms for much better prediction qualities and model construction performance. Have a look at the OLS (orthogonal least squares) and OFR (orthogonal forward regression) algorithm family. You will easily find detailed algorithm descriptions, easy to code in any suitable language. However, there is currently no Julia implementation I am aware of. I found only Matlab implementations and made my own java implementation, some years ago. I have plans to port it to julia, but that has currently no priority and may last some years. Meanwhile - why not coding by yourself? You won't find any other language making it easier to code a prototype and turn it into a highly efficient production algorithm running heavy load on a CUDA enabled GPGPU.
I recommend this quite new publication, to start with: Nonlinear identification using orthogonal forward regression with nested optimal regularization

What is the relationship between PyTorch and Torch?

There are two PyTorch repositories :
https://github.com/hughperkins/pytorch
https://github.com/pytorch/pytorch
The first clearly requires Torch and lua and is a wrapper, but the second doesn't make any reference to the Torch project except with its name.
How is it related to the Lua Torch?
Here a short comparison on pytorch and torch.
Torch:
A Tensor library like numpy, unlike numpy it has strong GPU support.
Lua is a wrapper for Torch (Yes! you need to have a good understanding of Lua), and for that you will need LuaRocks package manager.
PyTorch:
No need for the LuaRocks package manager, no need to write code in Lua. And because we are using Python, we can develop Deep Learning models with utmost flexibility. We can also exploit major Python packages likes scipy, numpy, matplotlib and Cython with PyTorch's own autograd.
There is a detailed discussion on this on pytorch forum. Adding to that both PyTorch and Torch use THNN. Torch provides lua wrappers to the THNN library while Pytorch provides Python wrappers for the same.
PyTorch's recurrent nets, weight sharing and memory usage with the flexibility of interfacing with C, and the current speed of Torch.
For more insights, have a look at this discussion session here.
Just to clarify the confusion between both pytorch repositories:
pytorch/pytorch is very similar to (Lua) Torch but in Python. So it's a wrapper over THNN. This was written by Facebook too.
hughperkins/pytorch: I have come across this repo when I was developing in Torch before pytorch existed, but I have never used it so I'm not quite sure if it is a wrapper written in Python over (Lua) Torch which is in turn a wrapper over THNN OR a wrapper over THNN and Lua. In both case, this is not the original version of Torch. It was written by Hugh Perkins when there was no Python alternative for Torch.
If you are wondering which one to go for, I would definitely recommend pytorch/pytorch as it communicates directly with THNN, is written by the people who made THNN and is continuously maintained. hughperkins/pytorch does not seem to be maintained anymore.

Export C# Encog Neuronal Network to C++

I have used the Encog C# framework to create a neural network. The neural network is fully trained. So I would like to use the neural network in my main application to solve a subproblem.
Is there a way to export the neural network into my main application which is written in C++?
If you have such wish, then most straightforward way would be to convert C# code to C++ by yourself. That way actually isn't practical or achievable easy. So I propose you another way. From your C++ app use encog as .Net assembly. There are plenty of articles which explain how to call .Net assembly from C++.

Use of third-party library

I'm interested in using Alea GPU with a third-party library and am trying to get a sense of my options. Specifically, I'm interested in using this L-BFGS library. I'm fairly new to the F# ecosystem but do have experience with both CUDA and functional programming.
I've been using that L-BFGS library as part of a program which implements logistic regression. It would be neat if I could assume the library correct and write the rest of my code (including that which runs on the GPU) in type-safe F#.
It seems possible to link C++ with F#. Assuming I figure out how to integrate the L-BFGS library into a F# program, would the introduction of Alea GPU cause any issues?
What I am trying to avoid is re-writing L-BFGS in F# using Alea. However, maybe that's actually the easiest path to using F#. If Alea has any facilities for nonlinear optimization, I could probably use those instead.
Alea GPU does not have a nonlinear optimizer yet. The CUDA version has a slightly different implementation than the standard CPU L-BFGS which sometimes causes some accuracy issues. Apart from this I did not face any issues with the code, except that the performance win also significantly depends on the objective function. The objective function for logistic regression is numerically relatively cheap.
We have an internal C# version for this code ported to Alea GPU, which could be also used from F# and we plan to release it in a future version.

Open Source Neural Network Library [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am looking for an open source neural network library. So far, I have looked at FANN, WEKA, and OpenNN. Are the others that I should look at? The criteria, of course, is documentation, examples, and ease of use.
Last update: 2020/03/24 (I will update this answer from time to time...)
Simple Implementations of Neural Networks
FANN is a very popular implementation in C/C++ and has bindings for many other languages.
In scikit-learn (Python) 0.18 (current developement version) there will be an implementation of feed-forward neural networks (API documentation).
And I must mention my own project, which is called OpenANN (Documentation). It is written in C++ and has Python bindings.
Deep Learning
Because neural networks are quite popular in research and industry at the moment ("deep learning") there are many research libraries available. Most of them are kind of easy to set up, integrate, and use. Although not as easy as the libraries mentioned above. They provide leading edge functionality and high performance (with GPUs etc.). Most of these libraries also have automatic differentiation. You can easily specify new architectures, loss functions etc. and don't have to specify the backpropagation manually.
TensorFlow from Google (C++/Python)
PyTorch from Facebook, in Python, can be extended with C/C++
mxnet (C++, Python, R, Scala, Julia, Matlab, Javascript)
Deeplearning4j (Java)
CNTK from Microsoft (training in Python / evaluation in C++/C#/Java/Python)
Chainer (Python)
PaddlePaddle from Baidu in CUDA/C++ with Python bindings
NNabla from Sony in Cuda/C++11 with Python bindings
A performance comparison for GPU-accelerated libraries can be found here (a bit outdated unfortunately). A comparison of GPUs and library versions can be found here.
Inactive:
Keras: It could use Tensorflow, Theano, and CNTK as a backend. (Now part of tensorflow as its high-level interface.)
Caffe from Berkeley Vision and Learning Center in C++ with Python bindings
Darknet: CNNs in C, known for the implementations of the YOLO object detector.
Neon from Intel Nervana provides very efficient implementations (Python)
MatConvNet (Matlab)
Theano (Python) and its high-level APIs:
Pylearn 2
Theanets
scikit-neuralnetwork
Lasagne
Blocks based on Theano (Python)
cuda-convnet2 in CUDA/C++ with Python bindings
Hebel (Python)
Caffe2 from Facebook in C++ with Python bindings; has been joined with PyTorch
Neural Networks for Torch 7 (Lua, Torch 7 is a "Matlab-like environment", overview of machine learning algorithms in Torch)
PyBrain (Python) contains different types of neural networks and training methods.
Encog (Java and C#)
If you want flexibility in defining network configurations, like sharing parameters or creating different types of convolutional architectures, then you should look at the family of Torch libraries: http://www.torch.ch/.
I haven't gone through the documentation for Torch 7 yet, but documentation for the other versions was pretty decent and the code is very readable (in Lua and C++).
You can use accord.net framework. http://accord-framework.net/
It contains Neural learning algorithms such as Levenberg-Marquardt, Parallel Resilient Backpropagation, the Nguyen-Widrow initialization algorithm, Deep Belief Networks and Restrictured Boltzmann Machines, and many other neural network related items.
Netlab is a commonly used Matlab library. (free and open source)
The Netlab toolbox is designed to provide the central tools necessary
for the simulation of theoretically well founded neural network
algorithms and related models for use in teaching, research and
applications development. It is extensively used in the MSc by
Research in the Mathematics of Complex Systems.
The Netlab library includes software implementations of a wide range
of data analysis techniques, many of which are not yet available in
standard neural network simulation packages. Netlab works with Matlab
version 5.0 and higher but only needs core Matlab (i.e. no other
toolboxes are required). It is not compatible with earlier versions of
Matlab.

Resources