Open waldirborbajr opened 2 years ago
hi, i think you use the wrong way to use this packages. here its the simply examples.
cd ~/go/src/github.com/sjwhitworth/golearn/examples/knnclassifier
go build knnclassifier_iris.go
then you will get this
wuming@B-Q4GZQ05P-1944 ~/go/src/github.com/sjwhitworth/golearn/examples/knnclassifier master ± ll
total 6184
-rwxr-xr-x 1 wuming staff 3.0M Nov 14 21:50 knnclassifier_iris
-rw-r--r-- 1 wuming staff 923B Oct 14 15:57 knnclassifier_iris.go
then run the command
./knnclassifier_iris
Instances with 88 row(s) 1 attribute(s)
Attributes:
* CategoricalAttribute("Species", [Iris-setosa Iris-versicolor Iris-virginica])
Data:
Iris-setosa
Iris-virginica
Iris-virginica
Iris-versicolor
Iris-setosa
Iris-virginica
Iris-setosa
Iris-versicolor
Iris-setosa
Iris-setosa
Iris-versicolor
Iris-versicolor
Iris-versicolor
Iris-setosa
Iris-virginica
Iris-setosa
Iris-setosa
Iris-setosa
Iris-virginica
Iris-versicolor
Iris-setosa
Iris-setosa
Iris-versicolor
Iris-versicolor
Iris-virginica
Iris-virginica
Iris-setosa
Iris-virginica
Iris-versicolor
Iris-virginica
...
58 row(s) undisplayed
Reference Class True Positives False Positives True Negatives Precision Recall F1 Score
--------------- -------------- --------------- -------------- --------- ------ --------
Iris-versicolor 27 1 58 0.9643 0.9310 0.9474
Iris-setosa 30 0 58 1.0000 1.0000 1.0000
Iris-virginica 28 2 57 0.9333 0.9655 0.9492
Overall accuracy: 0.9659
I was having the same error. The library requires you to have the C compiler (cpp), I think installing it correctly you can solve this problem.
Hi, I am trying to run a simple example and I'm facing the error below.
❯ go run cmd/main.go
github.com/sjwhitworth/golearn/knn
../../../go/pkg/mod/github.com/sjwhitworth/golearn@v0.0.0-20211014193759-a8b69c276cd8/knn/knn.go:132:16: KNN.optimisedEuclideanPredict undefined (type *KNNClassifier has no field or method optimisedEuclideanPredict)
❯ go version go version go1.19 linux/amd64
❯ cat go.mod module localhost/mlpipeline
go 1.19
require github.com/sjwhitworth/golearn v0.0.0-20211014193759-a8b69c276cd8
require ( github.com/gonum/blas v0.0.0-20181208220705-f22b278b28ac // indirect github.com/gonum/lapack v0.0.0-20181123203213-e4cdc5a0bff9 // indirect github.com/gonum/matrix v0.0.0-20181209220409-c518dec07be9 // indirect github.com/google/go-cmp v0.4.0 // indirect github.com/guptarohit/asciigraph v0.5.1 // indirect github.com/mattn/go-runewidth v0.0.7 // indirect github.com/olekukonko/tablewriter v0.0.4 // indirect github.com/rocketlaunchr/dataframe-go v0.0.0-20201007021539-67b046771f0b // indirect golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5 // indirect golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a // indirect gonum.org/v1/gonum v0.8.1 // indirect )
... code ...