What does the ANN: in the title mean?
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 const
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 > wrote:
> > quick question: How do I define a type most effective so that I can give
> it both single values, vectors and Arrays as variables?
&
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
type x
value::Union{Array{Float64},Float64}
end
gives me error:
type: instantiate_type: expected TypeConstructor, got function
Many thanks! works
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 ha
I think I had a problem in how I used the resulting data that slowed it
down.
Solved, Thanks
Sorry, thought I could delete threadso deleted first postmy bad
Contents/Resources/
> julia/bin:$PATH
>
> This is a pretty quick process that does not require crippling my laptop
> for 10+ minutes while it builds.
>
> On Friday, May 16, 2014 8:32:38 AM UTC-4, Jon Norberg wrote:
>>
>> Hi all,
>>
>> I have been using julia
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
mac
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 funct
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 iju
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 expre
r
>
> Array(parms, 0)
>
> — Jon
>
> On Jun 15, 2014, at 11:24 PM, Jon Norberg > wrote:
>
> p=Vector{parms}
>
>
>
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 fail
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
Remarkably good idea, thanks for sharing. I like the clean readable code
but efficient if needed idea. It would be amazing if the recent
developments could be added as you hint at for people to learn.
many thanks
On Saturday, February 28, 2015 at 4:19:18 PM UTC+1, Deniz Yuret wrote:
>
> KUnet.j
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
Its probably simple but I can't get it to work.
I simply want to use pythons nltk module through julia.
http://nltk.org/howto/wordnet.html
I tried
@pyimport wordnet as wn
and
@pyimport nltk as wn
but can't seem to interface to use eg. out=wn.synsets("car")
do I need to use
pyeval()
Everything works well in Python btw
Yes, fordon to say it workshops perfectly in Python
Autocorrect does not work well.I meant: Forgot to say everything works in
Python
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"]
>
I did mean
wn.synsets("car")
or
wn.synsets('car')
won't work. should be simple solution but can't figure it out from the
pycall manual :-/
On Wednesday, January 8, 2014 11:35:53 AM UTC, Jon Norberg wrote:
>
> Ok, so far so good, but it doesn't acc
outch, a very clear case of RTFM
wn[:synsets]("car")
just as it is described if you read the pycall CAREFULLY
please make fun of me.
Love Julia :-D
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,
Great. And how dose one get the text from pyobject to a julia string?
Thanks very much
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
is this why I get this on latest julia studio on mac with recently updated
packages:
julia> using DataFrames
julia> using RDatasets
julia> iris = data("datasets", "iris")
data not defined
??
Hi
I am trying to create nested structs like in matlab. I understand types are
the equivalent. I want to be able to create something like
a[1].b[1:10]=10
a[1].other[1:20)=9.2
a[2].b[1:10]=5
a[2].other[1:20)=1.22
Also, how would one list all fields like
fields(a)
"b"
"other"
I have been tryi
nd
> # Initialize the array
> a = [ Bother(zeros(Int64,10), zeros(20)) for x in 1:2 ]
> # Then your assignments work (after fixing the parenthesis)
> a[1].b[1:10] = 10
> a[1].other[1:20] = 9.2
> a[2].b[1:10] = 5
> a[2].other[1:20] = 1.22
>
>
>
> On Sunday, January 26,
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 cus
Ok, thanks, I am all set now :-)
Performance WILL be an issue later. So dict is a beter choice for that? Can i
create them similarly?
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?
Ok, I was tired when I wrote the above :-/
This works:
rand(10,30).*rand(10,30)
rand(10,1).*rand(10,30)
as one expects,
and this one works too
sprand(10,30,0.1).*sprand(10,30,0.1)
but this one don't:
sprand(10,1,0.1).*sprand(10,30,0.1)
ErrorException("Incompatible sizes")
Is this just
I am working on some sparse representation models.
I was wondering if its difficult to implement a version of distance.jl so
that one could write:
r=pairwise(spzeros(n,n),Euclidean(),A,B,threshold)
and produce a sparse output with distances only where
Euclidean(A,B)
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
jj=(j-1
Thank you very much Douglas! I learned a lot there. I didn't get it to work
straight away (running julia studio so its using julia 0.2). But these
changes made it work:
function subinds(k, N)
step = iceil(N/k)
rng = 1:step
res = [rng + j * step for j in 0:k-2]
push!(res, ((k
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
And that smart way is of course kNN algorithm...
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 Pa
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
>
> > wrote:
>
>> Amazing, just what I was looking
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
with
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 p
What is the best way to display graphics driven by javascript in IJulia?
For example these two:
http://rectangleworld.com/demos/ColorBoids/ColorBoids01.html
http://bl.ocks.org/mbostock/raw/4636377/
I tried from what I could find googling i.e.
readchomp html
and displaying and trying with
I Will check That out, thanks
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 for
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.
Also, I sometimes seem to get issues with what libraries are being used. I
am not very good at this but I understand there are different compiler
libraries and native osx ones. How do you guys handle this? or is it not an
issue using brew?
On Sunday, May 18, 2014 6:39:38 PM UTC+2, Jon Norberg
I've found that the best solution for me was to install Jupyter server on my
desktop machine and just run Julia as well as write code by opening a
webbrowser on my iPad Connection to it. Jupyter has a text-only editor that
supports Julia syntax in addition to the notebooks. I do miss atom though
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
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 TensorFl
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
Thanks, that works perfectly
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, i
the dictchannel is in the julia package as an example of Channels
https://github.com/JuliaLang/julia/blob/master/examples/dictchannel.jl
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)
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 wor
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...)
put!(!Matched::RemoteRef{T<:Abstr
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 so
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())
println("got
Anyone have any experiences with protobuf/web Sockets?
Utterly seconding that. Amazing community and beautiful language.
Thanks all!
Jon Norberg
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: Arg
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?
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 fo
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
unicode equivalent:
>
> D[i+1-d÷2:j-3+q*5]
>
>
>
> On Wednesday, November 18, 2015 at 4:53:10 PM UTC+8, Jon Norberg wrote:
>>
>> 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]
&
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
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 t
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 prob
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
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)
[0.5,0
Many thanks all, I learned a lot again from this great community.
Jon
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 g
Wow, thanks a lot, That one I would never had a chance to figure out.
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 documenta
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")
a
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 3
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
Ah yes of course, sorry :-) and thanks
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
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
91 matches
Mail list logo