MCPcopy Create free account
hub / github.com/datastream/libsvm / Solve_one_class

Method Solve_one_class

svm.go:1385–1411  ·  view source on GitHub ↗
(prob *SVM_Problem, param *SVM_Parameter, alpha []float64, si *SolutionInfo)

Source from the content-addressed store, hash-verified

1383}
1384
1385func (this *SVM) Solve_one_class(prob *SVM_Problem, param *SVM_Parameter, alpha []float64, si *SolutionInfo) {
1386 l := prob.l
1387 zeros := make([]float64, l)
1388 ones := make([]int8, l)
1389 var i int
1390
1391 n := int(param.nu) * prob.l // # of alpha's at upper bound
1392
1393 for i = 0; i < n; i++ {
1394 alpha[i] = 1
1395 }
1396 if n < prob.l {
1397 alpha[n] = param.nu*float64(prob.l) - float64(n)
1398 }
1399 for i = n + 1; i < l; i++ {
1400 alpha[i] = 0
1401 }
1402
1403 for i = 0; i < l; i++ {
1404 zeros[i] = 0
1405 ones[i] = 1
1406 }
1407
1408 s := new(Solver)
1409 s.Solve(l, NewONE_CLASS_Q(prob, param), zeros, ones,
1410 alpha, 1.0, 1.0, param.eps, si, param.shrinking)
1411}
1412
1413func (this *SVM) Solve_epsilon_svr(prob *SVM_Problem, param *SVM_Parameter, alpha []float64, si *SolutionInfo) {
1414 l := prob.l

Callers 1

SVM_train_oneMethod · 0.95

Calls 2

NewONE_CLASS_QFunction · 0.85
SolveMethod · 0.45

Tested by

no test coverage detected