Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update examples? #20

Closed
alainchau opened this issue Nov 24, 2019 · 1 comment
Closed

Update examples? #20

alainchau opened this issue Nov 24, 2019 · 1 comment

Comments

@alainchau
Copy link

The docs say to use transform(DiffMap, X; d=2, t=1, ɛ=1.0) but I get the error

UndefVarError: k not defined

Stacktrace:
 [1] (::getfield(MultivariateStats, Symbol("#kw##transform")))(::NamedTuple{(:d, :t, :ε),Tuple{Int64,Int64,Float64}}, ::typeof(transform), ::Type, ::Array{Float64,2}) at ./none:0
 [2] top-level scope at In[66]:4

Should the docs/readme be updated or is the api still in flux? I got this example working if you want to use it. Not sure how to get diffmap to return a circle like wikipedia claims (any ideas?). Isomap looks good though :)

# Create winding curve
t = collect(1:500) / 500 * 2π
X = zeros(3,500)
X[1,:] = cos.(t).*(.5cos.(6t).+1)
X[2,:] = sin.(t).*(.4cos.(6t).+1)
X[3,:] = 0.4sin.(6t)

# Isomap
Y = transform(fit(Isomap, X))
scatter(Y[1,:], Y[2,:], zcolor=t, legend=nothing, title="isomap")

# Diffmap
M = fit(DiffMap, X, ε=0.3 , t=8, maxoutdim=2)
Y = transform(M)
scatter(Y[1,:], Y[2,:], zcolor=t, legend=nothing, title="diffusion map")

windingcurve

isomap

diffmap

wildart added a commit that referenced this issue Apr 10, 2020
@wildart
Copy link
Owner

wildart commented Apr 10, 2020

I fixed diffusion map, now it should work properly. Here is an example:

using ManifoldLearning, Plots, LinearAlgebra, StatsBase
X, _ = ManifoldLearning.spirals(1000, 0.02);
c = standardize(UnitRangeTransform, mapslices(norm, X, dims=1) |> vec, dims=1)
scatter3d(X[1,:], X[2,:], X[3,:], zcolor=c, legend=:none, ms=3., camera=(15.,15.))

spirals3D

R = transform(fit(DiffMap, X, α=0.5, t=5, ε=0.002))
scatter(R[1,:], R[2,:], zcolor=c, legend=:none, ms=3.)

spirals2D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants