johnmyleswhite / kNN.jl

The k-nearest neighbors algorithm in Julia
Other
22 stars 17 forks source link

What wrong in model = knn(X, y, metric = Euclidean()) #12

Open paulanalyst opened 10 years ago

paulanalyst commented 10 years ago

What wrong in model = knn(X, y, metric = Euclidean()) ERROR: function knn does not accept keyword arguments ? () | A fresh approach to technical computing () | () () | Documentation: http://docs.julialang.org | |_ | Type "help()" to list help topics | | | | | | |/ ` | | | | || | | | (| | | Version 0.3.0-prerelease+3431 (2014-06-03 20:06 UTC) / |_'||_|'_| | Commit 1769118* (2 days old master) |__/ | x86_64-w64-mingw32

julia> Pkg.update() INFO: Updating METADATA... INFO: Updating Distributions... INFO: Computing changes... INFO: No packages to install, update or remove

julia> using kNN

julia> using DataArrays

julia> using DataFrames

julia> using RDatasets

julia> using Distance

julia>

julia> iris = data("datasets", "iris") ERROR: no method data(ASCIIString, ASCIIString)

julia> X = array(iris[:, 1:4])' ERROR: iris not defined

julia> iris = ("datasets", "iris") ("datasets","iris")

julia> iris = ("datasets", "iris") ("datasets","iris")

julia> iris =dataset("datasets", "iris") 150x5 DataFrame |-------|-------------|------------|-------------|------------|-------------| | Row # | SepalLength | SepalWidth | PetalLength | PetalWidth | Species | | 1 | 5.1 | 3.5 | 1.4 | 0.2 | "setosa" | | 2 | 4.9 | 3.0 | 1.4 | 0.2 | "setosa" | | 3 | 4.7 | 3.2 | 1.3 | 0.2 | "setosa" | | 4 | 4.6 | 3.1 | 1.5 | 0.2 | "setosa" | | 5 | 5.0 | 3.6 | 1.4 | 0.2 | "setosa" | | 6 | 5.4 | 3.9 | 1.7 | 0.4 | "setosa" | | 7 | 4.6 | 3.4 | 1.4 | 0.3 | "setosa" | | 8 | 5.0 | 3.4 | 1.5 | 0.2 | "setosa" | | 9 | 4.4 | 2.9 | 1.4 | 0.2 | "setosa" | ? | 141 | 6.7 | 3.1 | 5.6 | 2.4 | "virginica" | | 142 | 6.9 | 3.1 | 5.1 | 2.3 | "virginica" | | 143 | 5.8 | 2.7 | 5.1 | 1.9 | "virginica" | | 144 | 6.8 | 3.2 | 5.9 | 2.3 | "virginica" | | 145 | 6.7 | 3.3 | 5.7 | 2.5 | "virginica" | | 146 | 6.7 | 3.0 | 5.2 | 2.3 | "virginica" | | 147 | 6.3 | 2.5 | 5.0 | 1.9 | "virginica" | | 148 | 6.5 | 3.0 | 5.2 | 2.0 | "virginica" | | 149 | 6.2 | 3.4 | 5.4 | 2.3 | "virginica" | | 150 | 5.9 | 3.0 | 5.1 | 1.8 | "virginica" |

julia> X = array(iris[:, 1:4])' 4x150 Array{Float64,2}: 5.1 4.9 4.7 4.6 5.0 5.4 4.6 5.0 6.8 6.7 6.7 6.3 6.5 6.2 5.9 3.5 3.0 3.2 3.1 3.6 3.9 3.4 3.4 3.2 3.3 3.0 2.5 3.0 3.4 3.0 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 5.9 5.7 5.2 5.0 5.2 5.4 5.1 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 2.3 2.5 2.3 1.9 2.0 2.3 1.8

julia> y = array(iris[:, 5]) 150-element Array{ASCIIString,1}: "setosa" "setosa" "setosa" "setosa" "setosa" "setosa" "setosa" "setosa" "setosa" "setosa" ? "virginica" "virginica" "virginica" "virginica" "virginica" "virginica" "virginica" "virginica" "virginica" "virginica"

julia> model = knn(X, y, metric = Euclidean()) ERROR: function knn does not accept keyword arguments

julia> model = kNN(X, y, metric = Euclidean()) ERROR: type: apply: expected Function, got Module

julia> model = kNN(X, y,Euclidean()) ERROR: type: apply: expected Function, got Module

julia> model = kNN(X, y, Euclidean()(X,y)) ERROR: type: apply: expected Function, got Module

julia> model = kNN(Euclidean()(X,y)) ERROR: type: apply: expected Function, got Module

julia> Euclidean(X,y) ERROR: no method Euclidean(Array{Float64,2}, Array{ASCIIString,1})

julia> Euclidean(()X,y) ERROR: no method *((), Array{Float64,2})

julia> (Euclidean().X,y) ERROR: type Euclidean has no field X

julia> (Euclidean(),X,y) (Euclidean(), 4x150 Array{Float64,2}: 5.1 4.9 4.7 4.6 5.0 5.4 4.6 5.0 6.8 6.7 6.7 6.3 6.5 6.2 5.9 3.5 3.0 3.2 3.1 3.6 3.9 3.4 3.4 3.2 3.3 3.0 2.5 3.0 3.4 3.0 1.4 1.4 1.3 1.5 1.4 1.7 1.4 1.5 5.9 5.7 5.2 5.0 5.2 5.4 5.1 0.2 0.2 0.2 0.2 0.2 0.4 0.3 0.2 2.3 2.5 2.3 1.9 2.0 2.3 1.8,

ASCIIString["setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa","setosa " "virginica","virginica","virginica","virginica","virginica","virginica","virginica","virginica" ,"virginica","virginica"])

julia> model=kNN(Euclidean(),X,y) ERROR: type: apply: expected Function, got Module

julia>

johnmyleswhite commented 10 years ago

Looks like you're working with an older version of the package.

paulanalyst commented 10 years ago

kNN 0.0.0

julia> Pkg.checkout("kNN") INFO: Checking out kNN master... INFO: Pulling kNN latest master... ERROR: unknown package NearestNeighbors required by kNN in error at error.jl:21 in requirements at pkg/query.jl:9

julia> Pkg.add("NearestNeighbors") ERROR: unknown package NearestNeighbors in wait at task.jl:51

any package NearestNeighbors on available list Paul

W dniu 2014-06-06 17:27, John Myles White pisze:

Looks like you're working with an older version of the package.

— Reply to this email directly or view it on GitHub https://github.com/johnmyleswhite/kNN.jl/issues/12#issuecomment-45349583.

paulanalyst commented 10 years ago

last error was on Win7. Now Updated Ubuntu 13,10 unknown package NearestNeighbors :/

julia> Pkg.update() INFO: Updating METADATA... INFO: Computing changes... INFO: No packages to install, update or remove

julia> using kNN

julia> using DataArrays

julia> using DataFrames

julia> using RDatasets

julia> using Distance

julia> Pkg.status() 4 required packages:

julia> Pkg.build("kNN")

julia> Pkg.checkout("kNN") INFO: Checking out kNN master... INFO: Pulling kNN latest master... ERROR: unknown package NearestNeighbors required by kNN in error at error.jl:21 in requirements at pkg/query.jl:9 in resolve at pkg/entry.jl:363 (repeats 3 times) in anonymous at pkg/entry.jl:185 in transact at pkg/git.jl:83 in _checkout at pkg/entry.jl:177 in checkout at pkg/entry.jl:192 in anonymous at pkg/dir.jl:25 in cd at file.jl:22 in cd at pkg/dir.jl:25 in checkout at pkg.jl:33

julia>

Paul

paulanalyst commented 10 years ago

New Julia , kNN updated and stiil the same bug: ERROR: unknown package NearestNeighbors required by kNN What to do ? Paul () | A fresh approach to technical computing () | () () | Documentation: http://docs.julialang.org | |_ | Type "help()" to list help topics | | | | | | |/ ` | | | | || | | | (| | | Version 0.3.0-prerelease+3590 (2014-06-09 22:47 UTC) / |_'||_|'_| | Commit c71c57a* (3 days old master) |__/ | x86_64-w64-mingw32

julia> Pkg.update() INFO: Updating METADATA... INFO: Updating cache of ArrayViews... INFO: Updating cache of DataFrames... INFO: Updating cache of StatsBase... INFO: Updating kNN... INFO: Updating Distributions... INFO: Computing changes... ERROR: unknown package NearestNeighbors required by kNN in error at error.jl:21 in requirements at pkg/query.jl:9

julia> Pkg.checkout("kNN") INFO: Checking out kNN master... fatal: Missing branch name; try -b ERROR: failed process: Process(git '--work-tree=C:\Users\SAMSUNG2\.julia\kNN' '--git-dir=C:\Users\S AMSUNG2\.julia\kNN\.git' checkout -q -t master, ProcessExited(128)) [128] in pipeline_error at process.jl:502 in run at pkg/git.jl:22

julia> Pkg.rm("kNN") ERROR: unknown package NearestNeighbors required by kNN in error at error.jl:21 in requirements at pkg/query.jl:9

julia>

johnmyleswhite commented 10 years ago

I would suggest you not use this package for a few months.

paulanalyst commented 10 years ago

It's sad :/

Paul

W dniu 2014-06-13 16:51, John Myles White pisze:

I would suggest you not use this package for a few months.

— Reply to this email directly or view it on GitHub https://github.com/johnmyleswhite/kNN.jl/issues/12#issuecomment-46020453.

Ivo-Balbaert commented 8 years ago

I would like to use this package in a Chapter for an upcoming book about Machine Learning and Julia, can kNN be made usable without too much effort? Thanks!