I should have added that growthV was a function
Function growthV(s,f)
Return s+f+q
End
An i am looking to get a list containing s, f and q
Hi, I asked in a thread some year ago how to get the parameters and variables
used in a function. I got some amazing help from the always very helpful
community (Thanks Mauro and more,
https://groups.google.com/forum/m/#!search/Jon$20norberg/julia-users/bV4VZxbzZyk).
However, as already hinted
Ah yes of course, sorry :-) and thanks
I get "LoadError: unknown package Knet" when using Pkg.add("Knet"). I am on 0.5.
Very interested in this julia native ML library, thanks for sharing
I have very little experience with tensor flow but am hoping to make a simple
version of the [Karpathy
game](http://cs.stanford.edu/people/karpathy/reinforcejs/waterworld.html)
eventually. However, Already at first attempt I get stuck with the kernel dying
on me at the last line (julia 0.5 rc
Anyone have any experiences with protobuf/web Sockets?
just to check that there is no problem in the formats, the following does send
a ljulia-protobuf formatted message to the html-client but somewhat
indirectly
msg = read(client)
iob = PipeBuffer();
write(iob,msg)
test = readproto(iob,com())
Dear julia community.
I can't figure out whats wrong here. I have a web socket implementation that
works just fine without using protobuf on the julsa/websocket side (in fact,
the html-client does send a protobuf array which just gets sent back without
unpacking and packing on the julia web
A=RemoteRef(()->Channel{Int64}(10), 1)
Works but
Put!(A,1,1) gives
LoadError: MethodError: `put!` has no method matching put!(::Channel{Int64},
::Int64, ::Int64)
Closest candidates are:
put!(::Channel{T}, ::Any)
put!(!Matched::Base.RemoteValue, ::Any...)
Strangely though, if I modify the put! function as:
function put!(D::DictChannel, k, v)
D.d[k] = v
notify(D.cond_take)
Println(keys(D.d))
D
end
And run this I get
Any[2,3,1]
(I added keps in that order), i.e. This works
So it seemed the function definition of keys does not
Strangely makning a function
function keys(D::RemoteRef{DictChannel})
keys(D.d)
end
Gives also error:
LoadError: type RemoteRef has no field d
Also, for the function put! That does work the function looks like:
function put!(D::DictChannel, k, v)
D.d[k] = v
notify(D.cond_take)
the dictchannel is in the julia package as an example of Channels
https://github.com/JuliaLang/julia/blob/master/examples/dictchannel.jl
I have great use of the dictchannel.jl example. I wanted to add the method keys
to it so I thought that I simply add the function:
function keys(D::DictChannel)
keys(D.d)
end
as well s add the function name in the import (I tried also without adding the
"keys") :
import Base: put!, wait,
Thanks, that works perfectly
I am trying to use a websocket to provide online input to a simulation that
runs on another process and update back with a given frequency. The examples I
have found all wait for a read event and then immediately write back. I would
like to have the ability to have separate read and write loops
I am following the examples in tensor flow.jl I get all the examples to work
nicely. however, when I want to change an activation function to tan or sigmoid
I get an error. I suspect I am doing something wrong rather than a problem with
the package so I ask here...
If I do this:
using
I mentioned a few issues on the Jupyter group regarding iPad usability, such as
kinetic scrolling and some issues mentioned above. It's working ok, but a few
things are still awkward for ipad
using Gadfly
L=Layer[]
push!(L,layer(x=1:10,y=rand(10),Geom.line)[])
push!(L,layer(x=1:10,y=rand(10),Geom.line)[])
push!(L,layer(x=1:10,y=rand(10),Geom.line)[])
plot(L)
Only awkward thing is the empty square bracket for some reason is needed
Styling colours using Themes (see gadfly
I have searched and tried a few things but cannot remove the background grids
in Gadfly. Its probably simple and I am missing something obvious...Any
suggestions would be appreciated.
layer(x=E,y=wetness(E,10.0), Geom.line,Theme(default_color=a[1],
line_width=2pt, grid_color=colorant"white")
Wow, thanks a lot, That one I would never had a chance to figure out.
Is it also possible to get a list of names of the variables used in a
function?
e.g. for
function f(x,y)
k=0.1
return x*y+k
end
I'd like to get a list ["k","x","y"]
My first thought was to make a method f() that returns this list, but if
its possible to do this otherwise and more
Many thanks all, I learned a lot again from this great community.
Jon
I would like to create a composite type and then also create an array that
has values from this type by reference. The behaviour I am looking for is
like this:
type c
a::Float64
b::Float64
end
x=c(0.1,0.2)
y=c(0.3,0.4)
z=[x.a,x.b,y.a,y.b]
show(z)
[0.1,0.2,0.3,0.4]
x.a=0.5
show(z)
nstead?
On Thursday, December 17, 2015 at 4:28:32 AM UTC+1, Steven G. Johnson wrote:
>
> On Wednesday, December 16, 2015 at 10:11:20 AM UTC-5, Jon Norberg wrote:
>>
>> Is it possible to dynamically create a composite type if I have a list of
>> strings for the fieldna
UTC+1, Steven G. Johnson wrote:
>
> On Wednesday, December 16, 2015 at 10:11:20 AM UTC-5, Jon Norberg wrote:
>>
>> Is it possible to dynamically create a composite type if I have a list of
>> strings for the fieldnames?
>
>
> While this is possible, you should pr
Is it possible to dynamically create a composite type if I have a list of
strings for the fieldnames?
Is it possible to do this in a function?
A=[]
push!(A,"X")
push!(A,"Y")
push!(A,"Z")
function defineCompositeType(A)
magic?
end
regards, Jon
Thanks for that pointer! Not a computer scientist nor even a very good coder,
but I just learned a bit more how julia works internally.
I did the xdump and saw the AST (learned what that is too)
xdump(:(type T X; Y; Z; end)) gives
Expr
head: Symbol type
args: Array(Any,(3,))
1: Bool
Maybe not strictly a julia question but maybe someone can help...
I just got brand new iMac. I set up everything for jupiter, julia and
ijulia. can launch notebook just fine. then I change the jupiter config to
serve the notebook via http. On the computer itself i can open using the ip
address
On a very practical note:
I need to to do inline calculations of indexes such as
D[i+1-d/2:j-3+q*5]
where i,d,j and q are Int64 and d is a multiple of 2 i.e. d/2 should always
be integer
What is the most efficient way to use an expression as above but to avoid
the Warning: indexing with non
I didn't get the above to work, including trying to set path with
cd("/Users/raukhur/Documents/Github/Landscapes")
However, for some reason the following did work:
push!(LOAD_PATH, "/Users/raukhur/Documents/Github/Landscapes")
I am fine using this, but if anyone knows what could be the cause
Dear Julia users,
I just switched to atom IDE from Juno. I am puzzled by one thing.
As in Juno, I first cd(myDir) to move to the directory where I have the files
for the module I am developing. In Juno I could then just type using myModule
to load it but in Atom I now only get
LoadError:
Hm, command palette just says "no match found" and even if I type it nothing
changes.
Also, 1) if I have a file outside the module folder, can I load it somehow by
providing a path? and 2) I quite like hydrogen, does it work the same way to
load a module with Julia Client: etc?
Utterly seconding that. Amazing community and beautiful language.
Thanks all!
Jon Norberg
I need to get random variables from poisson distributions with different
lambda
this is the only way I got it to work at the moment BUT its very slow!
using Distributions
lambda=linspace(0.1,2,100)
out=zeros(Int64,100)
for i=1:length(lambda)
P=Poisson(lambda[i])
out[i]=rand(P)
end
Anyone
Sorry, thought I could delete threadso deleted first postmy bad
I think I had a problem in how I used the resulting data that slowed it
down.
Solved, Thanks
leaftype?
On Monday, September 21, 2015 at 2:41:02 PM UTC+2, Yichao Yu wrote:
>
> On Mon, Sep 21, 2015 at 8:37 AM, Jon Norberg <jon.n...@ecology.su.se
> > wrote:
> > quick question: How do I define a type most effective so that I can give
> it both single va
quick question: How do I define a type most effective so that I can give it
both single values, vectors and Arrays as variables?
I now have:
type x
value::Array{Float64}
end
I can do x(rand(3)) as well as x(rand(3,3)) but not x(0.1)
the answer is probably in the forums but I couldn't
not sure what leaf type is?
I actually need more fields in the type so I do need it as some field
type x
value::Array{Float64}
otherfield...
end
Many thanks! works
type x
value::Union{Array{Float64},Float64}
end
gives me error:
type: instantiate_type: expected TypeConstructor, got function
What does the ANN: in the title mean?
I have:
type parms
r::Float64
K::Float64
end
k=Array(parms,20)
for i =1:20 k[i]=parms(1.1,2.2) end
addprocs(1)
nprocs() - 2
@parallel for i=1:20 k[i].r=2.0 end
gives error:
julia @parallel for i=1:20 k[i].r=2.0 end
fatal error on 2:
julia ERROR: parms not defined
in deserialize at
I'll second that, great community and some very very helpful people that
put a lot of effort into this.
Thanks
Great, solve first problem, thanks.
using DArray though gives
julia k=DArray(parms,20)
exception on 2: ERROR: no method parms((UnitRange{Int64},))
in anonymous at multi.jl:840
in run_work_thunk at multi.jl:613
in run_work_thunk at multi.jl:622
in anonymous at task.jl:6
ERROR: assertion
also this works but does not change values in b
@parallel for i=1:20 b[i]=k[i].r*k[i].K end
I tried making b=DArray{Float64,1} or b=dones(20,1) but still values in b
are not updated
do I need to use spawn/fetch or pmap or something like this?
Sorry, not fluent in parallel programming yet, but
Any hint on how to do this?:
type parms
r::Vector{Float64}
K::Vector{Float64}
end
r=rand(N)*(0.05-0.001)+0.001
K=rand(N)*100+1
p=Vector{parms}
p[1]=parms(r,K)
p[2]=parms(r,K)
etc
I get error:
no method setindex!(Type{Array{parms,1}}, parms, Int64)
while loading In[36], in
:24 PM, Jon Norberg jon.n...@ecology.su.se
javascript: wrote:
p=Vector{parms}
Hi, I am trying to find out the best (fast pretty) way to pass a bunch of
parameters to a function. I checked the group posts and compiled some I
found
const pnames = [:a, :b, :c, :d, :e]
macro unpack(ex)
Expr(:block, [:($(pnames[i]) = $ex[$i]) for i = 1:length(pnames) ]...) |
esc
end
There have been several posts about this, so I tried to compile what I
could find to compare speed and pretty coding:
http://nbviewer.ipython.org/urls/dl.dropboxusercontent.com/u/38371278/Function%20parms%20passing%20speed%20test.ipynb
Best speed is assigning values or variables inside the
Do you mean using a dict to pack/unpack them?
function f(x; args...)
###
end
where args is a dict?
I added the keyword version (not sure it is as intended though)
function with_keyword(x::Float64=1.1;
a::Float64=1.0,b::Float64=2.0,c::Float64=3.0,d::Float64=4.0,e::Float64=5.0)
dx= a*b*c*d*e::Float64
end
Results now are: (slower due to being on my macbook and couldn't change in
the
Many thanks Cameron, I'll try that setup. Did I understand that you use
brew to compile julia?
On Friday, May 16, 2014 4:21:19 PM UTC+2, Ethan Anderes wrote:
+1 for Cameron. I use the same workflow.
Hi all,
I have been using julia and ijulia for a while and everything worked fine.
over time I get more and more issues, trying to upgrade/reinstall etc and
now I can't get it to work at all anymore. As I intend to reinstall osx
anyway, I was wondering if you good people have any good setup
I Will check That out, thanks
Hi, anyone know how to help me with getting ijulia to run again (using
mavericks osx). I have clean install latest julia. I added a soft link so
captiveportal-49-129:~ jon$ which julia
/usr/local/bin/julia
and typing julia starts julia as expected from anywhere
Starting python wight he julia
I have been running julia for a while lately with ijulia and everything
worked nicely. then I started building julia with brew --HEAD to keep up to
date with the latest changes, worked well enough. But now something
happened and nothing works, test run won't work even though julia installs
Amazing, just what I was looking for.
However :-/ I did exactly s your read me, installed, and using exactly
your example I get:
julia y = S*x
fatal error on 2: ERROR: ParallelSparseMatMul not defined
Worker 2 terminated.
ProcessExitedException()
is it enough to just write
using
Thank you
On Friday, February 14, 2014 10:19:22 AM UTC+1, Amit Murthy wrote:
The `using ParallelSparseMatMul` must be after any `addprocs` statements.
On Fri, Feb 14, 2014 at 2:21 PM, Jon Norberg
jon.n...@ecology.su.sejavascript:
wrote:
Amazing, just what I was looking
yes, you are right, just saw the bug with si should be ii and jj
will use sub as soon as I get 0.3.
Also, I did this little script to sort the xy array before hand. just need
ot figure out a smart way to constrain the loops to avoid calculating pairs
of block that can't have any distance below
I also noted that pairwise has a hard limit just above 1*1 array
size output, at least it crashes julia for me. Is there a way to increase
this?
Well, I solved it for now with subsampling:
using Distance
n=5
a=rand(3,n)
#@time r=pairwise(Euclidean(),a,a)
subsample=10
m=integer(n/subsample)
s=spzeros(n,n)
r=zeros(m,m)
threshold=0.2
for i=1:subsample-1
ii=(i-1)*m+1
for j=1:subsample-1
rand(10).*rand(10,30)
but
sv=sparsevec([3,5,7],[0.1,0.0,3.2],4)
sv.*sprand(4,20,0.1)
sprandbool(10, 1, 0.1).*sprand(10,30,0.1)
rand(10).*sprand(10,30,0.1)
all give
Incompatible sizes
Is my syntax wrong?
Actually, one more question, can I in the creation of a = [ Bother(zeros(
Int64,10), zeros(20)) for x in 1:2 ] also put in a vector of custom types
e.g. a type of Bother?
I mean like: a = [ Bother(zeros(Int64,10), ArrayOf{Bother}) for x in 1:2 ]
On Sunday, January 26, 2014 1:28:49 PM UTC+1, Jon Norberg wrote:
Actually, one more question, can I in the creation of a = [ Bother(zeros(
Int64,10), zeros(20)) for x in 1:2 ] also put in a vector of custom types
e.g
Performance WILL be an issue later. So dict is a beter choice for that? Can i
create them similarly?
Thats great, now I am starting to be able to do what I want. Any idea how
one can list all properties and methods of a pyobject
Great. And how dose one get the text from pyobject to a julia string?
Thanks very much
Hi Jonathan
would you by any chance have some example code to share how you work with
NLTK using pycall. I wish there were more julia examples scripts available
for browning and learning.
Thanks,
Ok, so far so good, but it doesn't accept
wn.symsets(car)
is there a different way to use the functions?
Thanks
On Tuesday, January 7, 2014 10:34:37 PM UTC, Steven G. Johnson wrote:
@pyimport nltk
wn = nltk.corpus[wordnet]
Yes, fordon to say it workshops perfectly in Python
Autocorrect does not work well.I meant: Forgot to say everything works in
Python
Could anyone give me a little help in the right direction reg using nltk in
julia.
I do
@pyimport nltk.wordnet as wn
but I can's seem to figure out how to interact with e.g wn.synsets(car)
thanks for help
73 matches
Mail list logo