GithubHelp home page GithubHelp logo

danaugrs / go-tsne Goto Github PK

View Code? Open in Web Editor NEW
203.0 203.0 24.0 92.34 MB

t-Distributed Stochastic Neighbor Embedding (t-SNE) in Go

License: BSD 3-Clause "New" or "Revised" License

Go 100.00%
3d data-science dimensionality-reduction go machine-learning tsne unsupervised-learning visualization

go-tsne's People

Contributors

danaugrs avatar etiennedi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-tsne's Issues

Having trouble running example

go run mnist3d.go
# github.com/danaugrs/go-tsne/tsne
github.com/danaugrs/go-tsne/tsne/tsne.go:93:7: PlogP.Clone undefined (type *mat.Dense has no field or method Clone)
github.com/danaugrs/go-tsne/tsne/tsne.go:197:13: scaledGrad.Clone undefined (type *mat.Dense has no field or method Clone)
github.com/danaugrs/go-tsne/tsne/tsne.go:241:3: Q.Clone undefined (type *mat.Dense has no field or method Clone)
github.com/danaugrs/go-tsne/tsne/tsne.go:248:6: logQ.Clone undefined (type *mat.Dense has no field or method Clone)

Breaking change in gonum/mat -> Not compiling

A go get of this package fails with

go: downloading github.com/danaugrs/go-tsne v0.0.0-20190909160934-1b1e70e27c5d
go: found github.com/danaugrs/go-tsne/tsne in github.com/danaugrs/go-tsne v0.0.0-20190909160934-1b1e70e27c5d
go: finding module for package gonum.org/v1/gonum/mat
go: downloading gonum.org/v1/gonum v0.7.0
go: found gonum.org/v1/gonum/mat in gonum.org/v1/gonum v0.7.0
# github.com/danaugrs/go-tsne/tsne
../../../../pkg/mod/github.com/danaugrs/[email protected]/tsne/tsne.go:93:7: PlogP.Clone undefined (type *mat.Dense has no field or method Clone)
../../../../pkg/mod/github.com/danaugrs/[email protected]/tsne/tsne.go:197:13: scaledGrad.Clone undefined (type *mat.Dense has no field or method Clone)
../../../../pkg/mod/github.com/danaugrs/[email protected]/tsne/tsne.go:241:3: Q.Clone undefined (type *mat.Dense has no field or method Clone)
../../../../pkg/mod/github.com/danaugrs/[email protected]/tsne/tsne.go:248:6: logQ.Clone undefined (type *mat.Dense has no field or method Clone)

It seems there was a breaking change in gonum/mat here: gonum/gonum@c5f0156

It seems all that is required is to rename Clone() to CloneFrom(). Expect a PR soon ;-)

More importantly, I believe the project should introduce go modules to pin down its dependencies and prevent such issues in the future. I'll create a second issue for that.

mnist2d.go

Dear danaugrs

Thank you very much to share your interesting programs.
I am writing this because I have some question regarding to demo script (mnist2d.go)

I have followed the sample code which described in Examples.
I have got an error message.

command-line-arguments

./mnist2d.go:69:32: cannot use xy literal (type xy) as type plotter.XY in append

Do you know how to solve this issue?

Please let me know.
Thanks

Best wishes

README.md file needs updating

Really great work! I just noticed the README.md file needs updating for the usage instructions NewTSNE(). The learning rate param needs to be added to the example.

the example code is outdated

The example code provided under examples/ all use outdated g3n code any possibility that they would be updated?

Consider tagging module "tsne"?

I found that package github.com/danaugrs/go-tsne/tsne is placed in module github.com/danaugrs/go-tsne/tsne.

However, it seems that module github.com/danaugrs/go-tsne/tsne is not tagged. According to Go Modules wiki, submodule should be tagged like relative-path-to-root/vX.X.X.
At now, when trying to import package github.com/danaugrs/go-tsne/tsne, downstream would depends on pseudo-version of module github.com/danaugrs/go-tsne/tsne.

github.com/danaugrs/go-tsne/tsne v0.0.0-20220306153449-0ee45704632c

I think it is not very readable and difficult to upgrade. This is not conductive to version control either.
So, I propose whether it is possible to tag module tsne properly. For example, tsne/v0.0.1, tsne/v1.0.0etc, so that other project can use tag to import this module in go.mod.

A few questions so I can use my own data

Hi,

Installed everything and mnist2d works nicely out of Jupyter Notebook.
.png files are created in my folder and I can visualize the progression.

Now, I would really like to run the 2d on my images, a few questions:

  • how do I transform my .png images to create the csv file like we see in mnist2500_X.csv ?
  • my images are 533x800 pixels, is this too big ? the .png files for mnist2d were created in about 3 minutes on my PC
  • my .png files are in color, do i need to convert them to black and white first ?
  • do you have any legend for your charts ?

thanks

not compiling today at least

env:

go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/apple/Library/Caches/go-build"
GOENV="/Users/apple/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/apple/workspace/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/apple/workspace/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/opt/go/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/apple/workspace/go/src/github.com/gedw99/notes/_spec/hack/go-tsne/examples/mnist3d/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/wp/ff6sz9qs6g71jnm12nj2kbyw0000gp/T/go-build2637127592=/tmp/go-build -gno-record-gcc-switches -fno-common"

3d example:

cd mnist3d 
go mod init
go mod tidy
go: finding module for package github.com/g3n/engine/camera
go: finding module for package github.com/g3n/engine/app
go: finding module for package github.com/danaugrs/go-tsne/examples/data
go: finding module for package github.com/danaugrs/go-tsne/tsne
go: finding module for package github.com/g3n/engine/core
go: finding module for package github.com/g3n/engine/gls
go: downloading github.com/g3n/engine v0.1.0
go: finding module for package github.com/g3n/engine/graphic
go: finding module for package github.com/g3n/engine/gui
go: finding module for package github.com/g3n/engine/light
go: finding module for package github.com/g3n/engine/material
go: finding module for package github.com/g3n/engine/math32
go: finding module for package github.com/g3n/engine/renderer
go: finding module for package github.com/g3n/engine/texture
go: finding module for package github.com/g3n/engine/util/helper
go: finding module for package github.com/g3n/engine/window
go: finding module for package github.com/sjwhitworth/golearn/pca
go: finding module for package gonum.org/v1/gonum/mat
go: found github.com/danaugrs/go-tsne/examples/data in github.com/danaugrs/go-tsne v0.0.0-20200708172100-6b7d1d577fd3
go: found github.com/danaugrs/go-tsne/tsne in github.com/danaugrs/go-tsne v0.0.0-20200708172100-6b7d1d577fd3
go: found github.com/g3n/engine/camera in github.com/g3n/engine v0.1.0
go: found github.com/g3n/engine/core in github.com/g3n/engine v0.1.0
go: found github.com/g3n/engine/gls in github.com/g3n/engine v0.1.0
go: found github.com/g3n/engine/graphic in github.com/g3n/engine v0.1.0
go: found github.com/g3n/engine/gui in github.com/g3n/engine v0.1.0
go: found github.com/g3n/engine/light in github.com/g3n/engine v0.1.0
go: found github.com/g3n/engine/material in github.com/g3n/engine v0.1.0
go: found github.com/g3n/engine/math32 in github.com/g3n/engine v0.1.0
go: found github.com/g3n/engine/renderer in github.com/g3n/engine v0.1.0
go: found github.com/g3n/engine/texture in github.com/g3n/engine v0.1.0
go: found github.com/g3n/engine/window in github.com/g3n/engine v0.1.0
go: found github.com/sjwhitworth/golearn/pca in github.com/sjwhitworth/golearn v0.0.0-20210511113939-00d4cfd91a1b
go: found gonum.org/v1/gonum/mat in gonum.org/v1/gonum v0.9.1
go: finding module for package github.com/g3n/engine/util/helper
go: finding module for package github.com/g3n/engine/app
github.com/gedw99/notes/_spec/hack/go-tsne/examples/mnist3d imports
        github.com/g3n/engine/app: module github.com/g3n/engine@latest found (v0.1.0), but does not contain package github.com/g3n/engine/app
github.com/gedw99/notes/_spec/hack/go-tsne/examples/mnist3d imports
        github.com/g3n/engine/util/helper: module github.com/g3n/engine@latest found (v0.1.0), but does not contain package github.com/g3n/engine/util/helper

go run .
mnist3d.go:7:2: no required module provides package github.com/danaugrs/go-tsne/examples/data; to add it:
        go get github.com/danaugrs/go-tsne/examples/data
mnist3d.go:8:2: no required module provides package github.com/danaugrs/go-tsne/tsne; to add it:
        go get github.com/danaugrs/go-tsne/tsne
mnist3d.go:12:2: no required module provides package github.com/g3n/engine/app; to add it:
        go get github.com/g3n/engine/app
mnist3d.go:13:2: no required module provides package github.com/g3n/engine/camera; to add it:
        go get github.com/g3n/engine/camera
mnist3d.go:14:2: no required module provides package github.com/g3n/engine/core; to add it:
        go get github.com/g3n/engine/core
mnist3d.go:15:2: no required module provides package github.com/g3n/engine/gls; to add it:
        go get github.com/g3n/engine/gls
mnist3d.go:16:2: no required module provides package github.com/g3n/engine/graphic; to add it:
        go get github.com/g3n/engine/graphic
mnist3d.go:17:2: no required module provides package github.com/g3n/engine/gui; to add it:
        go get github.com/g3n/engine/gui
mnist3d.go:18:2: no required module provides package github.com/g3n/engine/light; to add it:
        go get github.com/g3n/engine/light
mnist3d.go:19:2: no required module provides package github.com/g3n/engine/material; to add it:
        go get github.com/g3n/engine/material
mnist3d.go:20:2: no required module provides package github.com/g3n/engine/math32; to add it:
        go get github.com/g3n/engine/math32
mnist3d.go:21:2: no required module provides package github.com/g3n/engine/renderer; to add it:
        go get github.com/g3n/engine/renderer
mnist3d.go:22:2: no required module provides package github.com/g3n/engine/texture; to add it:
        go get github.com/g3n/engine/texture
mnist3d.go:23:2: no required module provides package github.com/g3n/engine/util/helper; to add it:
        go get github.com/g3n/engine/util/helper
mnist3d.go:24:2: no required module provides package github.com/g3n/engine/window; to add it:
        go get github.com/g3n/engine/window
mnist3d.go:9:2: no required module provides package github.com/sjwhitworth/golearn/pca; to add it:
        go get github.com/sjwhitworth/golearn/pca
mnist3d.go:10:2: no required module provides package gonum.org/v1/gonum/mat; to add it:
        go get gonum.org/v1/gonum/mat


2d example:


cd mnist2d 
go run .
go mod init
go mod tidy
go: finding module for package gonum.org/v1/gonum/mat
go: finding module for package github.com/danaugrs/go-tsne/examples/data
go: finding module for package github.com/sjwhitworth/golearn/pca
go: finding module for package github.com/danaugrs/go-tsne/tsne
go: downloading gonum.org/v1/gonum v0.9.1
go: downloading github.com/sjwhitworth/golearn v0.0.0-20210511113939-00d4cfd91a1b
go: downloading github.com/danaugrs/go-tsne v0.0.0-20200708172100-6b7d1d577fd3
go: finding module for package gonum.org/v1/plot
go: finding module for package gonum.org/v1/plot/plotter
go: finding module for package gonum.org/v1/plot/plotutil
go: finding module for package gonum.org/v1/plot/vg
go: found github.com/danaugrs/go-tsne/examples/data in github.com/danaugrs/go-tsne v0.0.0-20200708172100-6b7d1d577fd3
go: found github.com/danaugrs/go-tsne/tsne in github.com/danaugrs/go-tsne v0.0.0-20200708172100-6b7d1d577fd3
go: found github.com/sjwhitworth/golearn/pca in github.com/sjwhitworth/golearn v0.0.0-20210511113939-00d4cfd91a1b
go: found gonum.org/v1/gonum/mat in gonum.org/v1/gonum v0.9.1
go: found gonum.org/v1/plot in gonum.org/v1/plot v0.9.0
go: found gonum.org/v1/plot/plotter in gonum.org/v1/plot v0.9.0
go: found gonum.org/v1/plot/plotutil in gonum.org/v1/plot v0.9.0
go: found gonum.org/v1/plot/vg in gonum.org/v1/plot v0.9.0

go run .
./mnist2d.go:75:9: assignment mismatch: 2 variables but plot.New returns 1 values

Having trouble with examples too

Having trouble with both e.g. but more concerned with the 2D for now.

Specifically in the 2D mnist example, at line 69 I get an error about the append having a xy literal in type plotter.XY. Did something change in the plotter lib?

(admittedly I am very new to GO and as such may be missing something basic here)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.