go: appease the linters
* also, build the correct pkg in pre-commit
This commit is contained in:
parent
189ceb5181
commit
2dfdd86460
@ -46,9 +46,9 @@ repos:
|
|||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
files: "flake.(nix|lock)$"
|
files: "flake.(nix|lock)$"
|
||||||
language: system
|
language: system
|
||||||
- id: nix-build-go-proj
|
- id: nix-build-go-ak0da
|
||||||
name: nix build go proj
|
name: nix build go ak0da
|
||||||
entry: nix build .#proj
|
entry: nix build .#ak0da
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
# trigger this hook on changes to any of nix (also flake.lock) files
|
# trigger this hook on changes to any of nix (also flake.lock) files
|
||||||
# and go's mod or sum files
|
# and go's mod or sum files
|
||||||
|
17
main.go
17
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),
|
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,
|
minScore,
|
||||||
)
|
)
|
||||||
|
|
||||||
// these values should be much higher as comapred to the scores for normal
|
// these values should be much higher as comapred to the scores for normal
|
||||||
// data.
|
// data.
|
||||||
fmt.Println("\tAnomaly scores for outliers are:")
|
fmt.Fprintln(os.Stderr, "\tAnomaly scores for outliers are:")
|
||||||
|
|
||||||
for i := randomDataSize; i < (randomDataSize + outliers); i++ {
|
for i := randomDataSize; i < (randomDataSize + outliers); i++ {
|
||||||
fmt.Print("\t")
|
fmt.Fprint(os.Stderr, "\t")
|
||||||
fmt.Println(predictions[i])
|
fmt.Fprintln(os.Stderr, predictions[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("we're done")
|
log.Println("we're done")
|
||||||
@ -97,10 +98,12 @@ func loadData() (*base.DenseInstances, error) {
|
|||||||
// a file in CSV format.
|
// a file in CSV format.
|
||||||
func prepData(path string) error {
|
func prepData(path string) error {
|
||||||
log.Println("generating data")
|
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)
|
log.Printf("saving data to file at '%s'\n", path)
|
||||||
|
|
||||||
f, err := os.Create(path)
|
f, err := os.Create(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("could not save data to file at '%s'\n", path)
|
log.Printf("could not save data to file at '%s'\n", path)
|
||||||
|
Loading…
Reference in New Issue
Block a user