diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b2a966d..6cabbb2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -46,9 +46,9 @@ repos: pass_filenames: false files: "flake.(nix|lock)$" language: system - - id: nix-build-go-proj - name: nix build go proj - entry: nix build .#proj + - id: nix-build-go-ak0da + name: nix build go ak0da + entry: nix build .#ak0da pass_filenames: false # trigger this hook on changes to any of nix (also flake.lock) files # and go's mod or sum files diff --git a/main.go b/main.go index 2a4fedf..3ef785d 100644 --- a/main.go +++ b/main.go @@ -48,19 +48,20 @@ func main() { } } - fmt.Printf("\tAverage anomaly score for normal data: %f\n", + fmt.Fprintf(os.Stderr, "\tAverage anomaly score for normal data: %f\n", avg/float64(randomDataSize), ) - fmt.Printf("\tMinimum anomaly score for normal data: %f\n", + fmt.Fprintf(os.Stderr, "\tMinimum anomaly score for normal data: %f\n", minScore, ) // these values should be much higher as comapred to the scores for normal // data. - fmt.Println("\tAnomaly scores for outliers are:") + fmt.Fprintln(os.Stderr, "\tAnomaly scores for outliers are:") + for i := randomDataSize; i < (randomDataSize + outliers); i++ { - fmt.Print("\t") - fmt.Println(predictions[i]) + fmt.Fprint(os.Stderr, "\t") + fmt.Fprintln(os.Stderr, predictions[i]) } log.Println("we're done") @@ -97,10 +98,12 @@ func loadData() (*base.DenseInstances, error) { // a file in CSV format. func prepData(path string) error { log.Println("generating data") - data := genData(true, randomDataSize, -1.0, 1.0) - log.Println("generating data - done") + data := genData(true, randomDataSize, -1.0, 1.0) + + log.Println("generating data - done") log.Printf("saving data to file at '%s'\n", path) + f, err := os.Create(path) if err != nil { log.Printf("could not save data to file at '%s'\n", path)