An implementation of the Pegasos algorithm [1] for solving Support Vector Machines in Go.
$ go get github.com/tetsuok/go-pegasos
$ go install github.com/tetsuok/go-pegasos/pegasos_learn
$ go install github.com/tetsuok/go-pegasos/pegasos_test
$ go test github.com/tetsuok/go-pegasos/pegasos
If you want to run testing including benchmarks, use check.sh
$ ./check.sh
go-pegasos accepts the same representation of training data as SVMlight uses. This format has potential to handle large sparse feature vectors.
$ ./pegasos_learn -m model_file train_file
Please note "-m" is required to save the trained model.
- -k INT: number of block size.
- -lambda FLOAT: Regularization parameter
- -m STRING: model file
- -r INT: seed
- -t INT: number of iterations
- -test STRING: If you set a test file, you can do training and testing at a time.
$ ./pegasos_test test_file model_file
[1] Shalev-Shwartz, Shai and Singer, Yoram and Srebro, Nathan. Pegasos: Primal Estimated sub-GrAdient SOlver for SVM. In Proceedings of the 24th international conference on Machine learning (ICML). 2007. pages 807-814.