anj1 / neuralnets.jl Goto Github PK
View Code? Open in Web Editor NEWGeneric artificial neural networks in Julia
Generic artificial neural networks in Julia
to take each setting in a vector of train parameters and output a Dict
for use in TrainReport
, possibly with another Dict
to convert variable names to user friendly names. e.g. learning_rate
-> "Learning rate"
.
Sorry for the vague title, but I'm having a number of different issues. I'm trying to compare NeuralNets.jl to an implementation I wrote a few months ago using the MNIST data, and I have not yet been able to train a mlp.
The data:
julia> using MNIST
julia> x, yy = traindata();
julia> n = length(yy)
60000
julia> y = zeros(10, n);
julia> for i in 1:n
yi = yy[i]
if yi == 0.0
y[10, i] = 1.0
else
y[yi, i] = 1.0
end
end
julia> #x is 784 x 60000
#y is 10 x 60000
Training with :levenberg_marquardt
results in a MemoryError
:
julia> using NeuralNets
julia> layer_sizes = [size(x, 1), 30, size(y, 1)]
3-element Array{Int64,1}:
784
30
10
julia> act = [logis, logis]
2-element Array{Function,1}:
logis
logis
julia> mlp = MLP(randn, layer_sizes, act);
julia> mlp1 = train(mlp, x, [], y, [], train_method=:levenberg_marquardt)
ERROR: MemoryError()
in Array at base.jl:230
in train at /home/sam/.julia/v0.3/NeuralNets/src/train.jl:66
Training with :gradient_descent
results in all weights being NaN
. Output not shown. Perhaps this is because I'm using logis
instead of logissafe
?
Training with gdmtrain
:
julia> gdmtrain(mlp, x, y)
ERROR: `.+` has no method matching .+(::NNLayer{Float64}, ::Float64)
in .+ at array.jl:758
in gdmtrain at /home/sam/.julia/v0.3/NeuralNets/src/gradientdescent.jl:41
Any suggestions?
Extend the levenberg_marquardt
optimization method to be able to work with multiple output neurons.
When I call train(nn, trainx, valx, traint, valt) I get the following message
julia> train
ERROR: UndefVarError: train not defined
The same doesn't happen when I call the gdmtrain (from the same package)
Am I doing anything wrong?
Thanks.
maxiters
here should be maxiter
, I think. But even if I fix that, I cannot run the XOR example with gradient descent.
I get
`setindex!` has no method matching setindex!(::ContiguousView{Float64,1,Array{Float64,1}}, ::Array{Float64,2}, ::UnitRange{Int64})
You might have used a 2d row vector where a 1d column vector was required.
Note the difference between 1d column vector [1,2,3] and 2d row vector [1 2 3].
You can convert to a column vector with the vec() function.
while loading In[8], in expression starting on line 21
in backprop! at /home/sam/.julia/v0.3/NeuralNets/src/backprop.jl:39
in backprop! at /home/sam/.julia/v0.3/NeuralNets/src/backprop.jl:35 (repeats 2 times)
in g! at /home/sam/.julia/v0.3/NeuralNets/src/train.jl:93
in fg! at /home/sam/.julia/v0.3/Optim/src/types.jl:150
in gradient_descent at /home/sam/.julia/v0.3/Optim/src/gradient_descent.jl:56
in optimize at /home/sam/.julia/v0.3/Optim/src/optimize.jl:328
in train at /home/sam/.julia/v0.3/NeuralNets/src/train.jl:97
Hi,
the example provided in the release fails with
ERROR: `NNLayer{T}` has no method matching NNLayer{T}(::Array{Float64,2}, ::Array{Float64,1}, ::Function, ::Function, ::Bool, ::Float64, ::Float64, ::Array{Float64,1})
in NNLayer at /home/davide/.julia/v0.3/NeuralNets/src/mlp.jl:19
in MLP at /home/davide/.julia/v0.3/NeuralNets/src/mlp.jl:85
in include_3B_215 at /usr/bin/../lib/julia/sys.so
in include_from_node1 at loading.jl:128
in process_options_3B_1728 at /usr/bin/../lib/julia/sys.so
in _start_3B_1715 at /usr/bin/../lib/julia/sys.so (repeats 2 times)
while loading /home/davide/prova.jl, in expression starting on line 19
I am thus unable to use the MLP
Thanks,
Davide
Hi,
Thanks for the package.
Would you register it, so it is easier to install and it has more visibility?
Davide
Hi,
Thanks for the package.
Would you register it, so it is easier to install and it has more visibility?
Davide
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.