febeling/rb-libsvm — pull request #9 by febeling (2014-11-16 23:16:25+00:00)
Title: The gem documentation is sparse

Information I assume should be explained to a beginner doesn't seem to be easily accessible. For example, in both examples, the code

```ruby
parameter.cache_size = 1 # in megabytes
parameter.eps = 0.001
parameter.c = 10
```

is not explained and only the first line is somehow self evident. Yet without these lines, the examples do not run (because they each default to 0). I assume `.c` corresponds to [the formula at libsvm's homepage](http://www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf) (PDF) ‘C’. I'm not sure about `.eps` (except that it's probably an epsilon).

Similarly, it's not obvious until you look deeper into the `.public_methods` that the [kernel type](http://rubydoc.info/gems/rb-libsvm/1.0.7/Libsvm/KernelType) should be set as a parameter passed to the model.

Another one is the presence of both an `examples` attribute and a `set_examples` method, with clear indications on how to use only the latter. It's not clear whether `set_examples` can accept data online, which I believe SVM should be able to handle.

The README should also probably mention the presence of more examples in the example folder.

Thanks for your work.

EDIT:

Reading the source code a bit more, I found this:

```c
double eps;	/* stopping criteria */
double C;	/* for C_SVC, EPSILON_SVR and NU_SVR */
```

so I assume `eps` is used to determine if the last iteration made enough changes to the weight vector to warrant a new one (?)

EDIT2: I am currently reading the libsvm README and linking to it might be a good enough minimum.

It also indicates that the basic executable `svm-train` uses sensible defaults for epsilon, c, and the cache size, see:

```

-c cost : set the parameter C of C-SVC, epsilon-SVR, and nu-SVR (default 1)
...
-m cachesize : set cache memory size in MB (default 100)
-e epsilon : set tolerance of termination criterion (default 0.001)
```