1
0
mirror of https://github.com/sjwhitworth/golearn.git synced 2025-04-26 13:49:14 +08:00

Merge pull request #46 from Sentimentron/build-fix

Trying to fix the Travis build
This commit is contained in:
Stephen Whitworth 2014-07-07 08:13:26 +01:00
commit fbc7df8c2c
2 changed files with 5 additions and 9 deletions

View File

@ -6,7 +6,7 @@ go:
- tip - tip
before_install: before_install:
- sudo apt-get update -qq - sudo apt-get update -qq
- sudo apt-get install -qq libatlas-base-dev - sudo apt-get install -qq libatlas-base-dev liblinear-dev
install: install:
- go get github.com/smartystreets/goconvey/convey - go get github.com/smartystreets/goconvey/convey
- go get -v ./... - go get -v ./...

View File

@ -1,8 +1,8 @@
package linear_models package linear_models
/* /*
#cgo LDFLAGS: -L ../ext/lib -llinear #cgo LDFLAGS: -llinear
#cgo CFLAGS: -I ../ext/liblinear_src #cgo CFLAGS:
#include <linear.h> #include <linear.h>
*/ */
import "C" import "C"
@ -28,9 +28,6 @@ const (
L1R_L2LOSS_SVC = C.L1R_L2LOSS_SVC L1R_L2LOSS_SVC = C.L1R_L2LOSS_SVC
L1R_LR = C.L1R_LR L1R_LR = C.L1R_LR
L2R_LR_DUAL = C.L2R_LR_DUAL L2R_LR_DUAL = C.L2R_LR_DUAL
L2R_L2LOSS_SVR = C.L2R_L2LOSS_SVR
L2R_L2LOSS_SVR_DUAL = C.L2R_L2LOSS_SVR_DUAL
L2R_L1LOSS_SVR_DUAL = C.L2R_L1LOSS_SVR_DUAL
) )
func NewParameter(solver_type int, C float64, eps float64) *Parameter { func NewParameter(solver_type int, C float64, eps float64) *Parameter {
@ -41,7 +38,6 @@ func NewParameter(solver_type int, C float64, eps float64) *Parameter {
param.c_param.nr_weight = C.int(0) param.c_param.nr_weight = C.int(0)
param.c_param.weight_label = nil param.c_param.weight_label = nil
param.c_param.weight = nil param.c_param.weight = nil
param.c_param.p = C.double(0.1)
return &param return &param
} }
@ -52,9 +48,9 @@ func NewProblem(X [][]float64, y []float64, bias float64) *Problem {
prob.c_prob.n = C.int(len(X[0]) + 1) prob.c_prob.n = C.int(len(X[0]) + 1)
prob.c_prob.x = convert_features(X, bias) prob.c_prob.x = convert_features(X, bias)
c_y := make([]C.double, len(y)) c_y := make([]C.int, len(y))
for i := 0; i < len(y); i += 1 { for i := 0; i < len(y); i += 1 {
c_y[i] = C.double(y[i]) c_y[i] = C.int(y[i])
} }
prob.c_prob.y = &c_y[0] prob.c_prob.y = &c_y[0]
prob.c_prob.bias = C.double(-1) prob.c_prob.bias = C.double(-1)