README.md in thundersvm-0.1.0 vs README.md in thundersvm-0.1.1

- old
+ new

@@ -1,16 +1,18 @@ # ThunderSVM -[ThunderSVM](https://github.com/Xtra-Computing/thundersvm) - high-performance parallel SVMs - for Ruby +[ThunderSVM](https://github.com/Xtra-Computing/thundersvm) - high performance parallel SVMs - for Ruby :fire: Uses GPUs and multi-core CPUs for blazing performance For a great intro on support vector machines, check out [this video](https://www.youtube.com/watch?v=efR1C6CvhmE). +[![Build Status](https://travis-ci.org/ankane/thundersvm.svg?branch=master)](https://travis-ci.org/ankane/thundersvm) + ## Installation -First, [install ThunderSVM](https://github.com/Xtra-Computing/thundersvm/blob/master/docs/how-to.md#install-thundersvm). Add this line to your application’s Gemfile: +Add this line to your application’s Gemfile: ```ruby gem 'thundersvm' ``` @@ -74,23 +76,23 @@ Defaults shown below ```ruby ThunderSVM::Model.new( - svm_type: :c_svc, # set type of SVM (c_svc, nu_svc, one_class, epsilon_svr, nu_svr) - kernel: :rbf, # set type of kernel function (linear, polynomial, rbf, sigmoid) - degree: 3, # set degree in kernel function - gamma: nil, # set gamma in kernel function - coef0: 0, # set coef0 in kernel function - c: 1, # set the parameter C of C-SVC, epsilon-SVR, and nu-SVR - nu: 0.5, # set the parameter nu of nu-SVC, one-class SVM, and nu-SVR - epsilon: 0.1, # set the epsilon in loss function of epsilon-SVR + svm_type: :c_svc, # type of SVM (c_svc, nu_svc, one_class, epsilon_svr, nu_svr) + kernel: :rbf, # type of kernel function (linear, polynomial, rbf, sigmoid) + degree: 3, # degree in kernel function + gamma: nil, # gamma in kernel function + coef0: 0, # coef0 in kernel function + c: 1, # parameter C of C-SVC, epsilon-SVR, and nu-SVR + nu: 0.5, # parameter nu of nu-SVC, one-class SVM, and nu-SVR + epsilon: 0.1, # epsilon in loss function of epsilon-SVR max_memory: 8192, # constrain the maximum memory size (MB) that thundersvm uses - tolerance: 0.001, # set tolerance of termination criterion + tolerance: 0.001, # tolerance of termination criterion probability: false, # whether to train a SVC or SVR model for probability estimates gpu: 0, # specify which gpu to use - cores: nil, # set the number of cpu cores to use (defaults to all) + cores: nil, # number of cpu cores to use (defaults to all) verbose: false # verbose mode ) ``` ## Data @@ -110,9 +112,38 @@ Or the path a file in `libsvm` format (better for sparse data) ```ruby model.fit("train.txt") model.predict("test.txt") +``` + +## GPUs + +To run ThunderSVM on GPUs, you’ll need to build the library from source. + +### Linux + +```sh +git clone --recursive --branch v0.3.4 https://github.com/Xtra-Computing/thundersvm +cd thundersvm +mkdir build +cd build +cmake .. +make +``` + +Specify the path to the shared library with: + +```ruby +ThunderSVM.ffi_lib = "path/to/build/lib/libthundersvm.so" +``` + +### Windows + +Follow the [official instructions](https://thundersvm.readthedocs.io/en/latest/get-started.html#installation-for-windows). Specify the path to the shared library with: + +```ruby +ThunderSVM.ffi_lib = "path/to/build/lib/libthundersvm.dll" ``` ## Resources - [ThunderSVM: A Fast SVM Library on GPUs and CPUs](https://github.com/Xtra-Computing/thundersvm/blob/master/thundersvm-full.pdf)