From 136f176d1d80fcc0ad69a01e9745a7e4fd6efbe1 Mon Sep 17 00:00:00 2001 From: Yashwant Date: Fri, 29 May 2020 21:40:30 +0530 Subject: [PATCH] Apply suggestions by @rcurtin. --- HISTORY.md | 2 ++ doc/guide/go_quickstart.hpp | 2 +- src/mlpack/bindings/go/CMakeLists.txt | 2 +- src/mlpack/bindings/go/mlpack/numcsv.go | 24 ++++++++++++------------ 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 0b2dfe09ea..4b5239da2a 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,7 @@ ### mlpack ?.?.? ###### ????-??-?? + * Add Go bindings (#1884). + * Added Dueling DQN to q_networks, Noisy linear layer to ann/layer and Empty loss to ann/loss_functions (#2414). diff --git a/doc/guide/go_quickstart.hpp b/doc/guide/go_quickstart.hpp index 30ef2df777..2b21567486 100644 --- a/doc/guide/go_quickstart.hpp +++ b/doc/guide/go_quickstart.hpp @@ -19,7 +19,7 @@ Installing the mlpack bindings for Go is somewhat time-consuming as the library must be built; you can run the following code: @code{.sh} -go get -d mlpack.org/v1/mlpack +go get -u -d mlpack.org/v1/mlpack cd ${GOPATH}/src/mlpack.org/v1/mlpack make install @endcode diff --git a/src/mlpack/bindings/go/CMakeLists.txt b/src/mlpack/bindings/go/CMakeLists.txt index d611bf2ec4..df555cd04f 100644 --- a/src/mlpack/bindings/go/CMakeLists.txt +++ b/src/mlpack/bindings/go/CMakeLists.txt @@ -22,7 +22,7 @@ if (BUILD_GO_BINDINGS) find_package(Gonum) if (NOT GO_FOUND OR NOT GONUM_FOUND) unset(BUILD_GO_BINDINGS CACHE) - message(FATAL_ERROR "Could not Build Go Bindings") + message(FATAL_ERROR "Go or Gonum not found; unable to build Go bindings!") endif() else () find_package(Go 1.11.0) diff --git a/src/mlpack/bindings/go/mlpack/numcsv.go b/src/mlpack/bindings/go/mlpack/numcsv.go index 15f1b14d89..ad1fb07cb4 100644 --- a/src/mlpack/bindings/go/mlpack/numcsv.go +++ b/src/mlpack/bindings/go/mlpack/numcsv.go @@ -1,17 +1,16 @@ package mlpack import ( - "encoding/csv" - "io" - "os" - "strconv" - "net/http" - "compress/gzip" - - "gonum.org/v1/gonum/mat" + "encoding/csv" + "io" + "os" + "strconv" + "net/http" + "compress/gzip" + "gonum.org/v1/gonum/mat" ) -// Load reads all of the numeric records from the CSV. +// Load() reads all of the numeric records from the CSV. func Load(filename string) (*mat.Dense, error) { var elements int var rows int @@ -49,7 +48,7 @@ func Load(filename string) (*mat.Dense, error) { return output, nil } -// Save writes all of the records to the CSV. +// Save() writes all of the records to the CSV. func Save(filename string, mat *mat.Dense) error { // Create the file file, err := os.Create(filename) @@ -78,7 +77,7 @@ func Save(filename string, mat *mat.Dense) error { return nil } -// Unizp unzips the given input to the given the output file. +// UnZip() unzips the given input to the given the output file. func UnZip(input string, output string) error { // Create the file out, err := os.Create(output) @@ -109,7 +108,8 @@ func UnZip(input string, output string) error { return nil } -// DownloadFile downloads the file from the given url and save it to the given filename. +// DownloadFile() downloads the file from the given url and +// save it to the given filename. func DownloadFile (url string, filename string) error { // Create the file out, err := os.Create(filename)