Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
github.com/ChengWu-NJ/libSvm
This is a full port of LIBSVM in the Go programming language. LIBSVM is a suite of tools and an API library for support vector classification, regression, and distribution estimation. This port implements the libsvm library in the form of a Go package called libSvm
. It also implements the svm-train
and svm-predict
command line tools.
This port has no external package dependencies, and uses only the native standard library.
go get github.com/ewalker544/libsvm-go
make
I have tried to make the Go implementation of svm-train
and svm-predict
plug-in compatibile with the original LIBSVM 3.18 distribution. This is to allow you to use the other tools available in the original distribution, like easy.py
and grid.py
.
svm-predict
should be 100% plug-in compatibile. However, svm-train
is plug-in compatible with one exception. The exception is the parameter weight flag used in the command. In this implementation, the flag is
-w i,weight : set the parameter C of class i to weight*C, for C-SVC (default 1)
For full documentation of the svm-train
and svm-predict
commands, please refer to the original LIBSVM web site.
import "github.com/ewalker544/libsvm-go"
param := libSvm.NewParameter() // Create a parameter object with default values
param.KernelType = libSvm.POLY // Use the polynomial kernel
model := libSvm.NewModel(param) // Create a model object from the parameter attributes
// Create a problem specification from the training data and parameter attributes
problem, err := libSvm.NewProblem("a9a.train", param)
model.Train(problem) // Train the model from the problem specification
model.Dump("a9a.model") // Dump the model into a user-specified file
import "github.com/ewalker544/libsvm-go"
// Create a model object from the model file generated from training
model := libSvm.NewModelFromFile("a9a.model")
x := make(map[int]float64)
// Populate x with the test vector
predictLabel := model.Predict(x) // Predicts a float64 label given the test vector
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.