Skip to content

Commit

Permalink
Switch SVM from 3rd order poly to simple linear
Browse files Browse the repository at this point in the history
  • Loading branch information
schollz committed Jan 6, 2017
1 parent 91ab5c2 commit 59b659f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions svm.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
// ./svm-scale -l 0 -u 1 svm.shuffled > svm.shuffled.scaled
// head -n 500 svm.shuffled.scaled > learning
// tail -n 1500 svm.shuffled.scaled > testing
// ./svm-train -s 0 -t 1 -b 1 learning > /dev/null
// ./svm-train -s 0 -t 0 -b 1 learning > /dev/null
// ./svm-predict -b 1 testing learning.model out

type Svm struct {
Expand Down Expand Up @@ -228,14 +228,14 @@ func calculateSVM(group string) error {
// }

cmd := "svm-train"
args := "-s 0 -t 1 -b 1 " + tempFileFull + " data/" + group + ".model"
args := "-s 0 -t 0 -b 1 " + tempFileFull + " data/" + group + ".model"
Debug.Println(cmd, args)
if _, err = exec.Command(cmd, strings.Split(args, " ")...).Output(); err != nil {
panic(err)
}

cmd = "svm-train"
args = "-s 0 -t 1 -b 1 " + tempFileTrain + " " + tempFileTrain + ".model"
args = "-s 0 -t 0 -b 1 " + tempFileTrain + " " + tempFileTrain + ".model"
Debug.Println(cmd, args)
if _, err = exec.Command(cmd, strings.Split(args, " ")...).Output(); err != nil {
panic(err)
Expand All @@ -244,10 +244,11 @@ func calculateSVM(group string) error {
cmd = "svm-predict"
args = "-b 1 " + tempFileTest + " " + tempFileTrain + ".model " + tempFileOut
Debug.Println(cmd, args)
_, err = exec.Command(cmd, strings.Split(args, " ")...).Output()
outCmd, err := exec.Command(cmd, strings.Split(args, " ")...).Output()
if err != nil {
panic(err)
}
Debug.Printf("%s SVM: %s", group, strings.TrimSpace(string(outCmd)))

// os.Remove(tempFileTrain + ".scaled")
// os.Remove(tempFileTest + ".scaled")
Expand Down Expand Up @@ -386,5 +387,5 @@ func makeSVMLine(v2 Fingerprint, macs map[string]int, locations map[string]int)
// ./svm-scale -l 0 -u 1 svm.shuffled > svm.shuffled.scaled
// head -n 500 svm.shuffled.scaled > learning
// tail -n 1500 svm.shuffled.scaled > testing
// ./svm-train -s 0 -t 1 -b 1 learning > /dev/null
// ./svm-train -s 0 -t 0 -b 1 learning > /dev/null
// ./svm-predict -b 1 testing learning.model out

0 comments on commit 59b659f

Please sign in to comment.