[julia-users] Updated YouTube channel page and website updates
We now have an updated and a better looking (thanks Shashi!) YouTube channel page, with all the videos from JuliaCon. We will keep this updated with new videos as they come. https://www.youtube.com/user/JuliaLanguage/ The website also now has a separate learning section (split from the teaching section, which is now focussed on material for instructors), where it is easier to find videos and tutorials. http://julialang.org/learning/ The JuliaCon page also has links to videos for all the talks. -viral
[julia-users] Re: Problem with v 0.3.0 on MacOSX 10.9.4
The simplest thing is to perhaps just nuke ~/.julia and install the packages again. This is rarely required nowadays, but sometimes it is simpler to do just that. -viral On Monday, August 25, 2014 8:38:47 PM UTC+5:30, Henry Smith wrote: Many thanks for the replies! A big help... I did the rm thing and also did a Pkg.rm(Stats) so it no longer appears at all in a status request. Now however when I do a Pkg.update I also get an error which I have not succeeded in figuring it out. Below is what I get when I request a Pkg.update() - Do I need to completely re-install the pkgs I have or some such? I would think not but... And what does it mean by Terminal's requirements... (I did this from the Mac Terminal program - the default on OSX, it seems...) TIA again Henry julia Pkg.update() INFO: Updating METADATA... INFO: Computing changes... ERROR: Terminals's requirements can't be satisfied because of the following fixed packages: julia in error at error.jl:22 in resolve at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib in update at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib in anonymous at pkg/dir.jl:28 in cd at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib in __cd#227__ at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib in update at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib (repeats 2 times) julia On Friday, August 22, 2014 4:52:16 PM UTC-4, Henry Smith wrote: Hi, Just d/led it and tried it out. I had a couple of old versions of 0.2.x (and still have 0.2.1 installed but trashed the others - some rc's). The computer is an iMac with 20 GB of RAM, 2.7 GHz quad i5. When I asked about the Pkg.status(), it came up with an error and similar for PKG.installed() and Pkg.update(). I copy the output below (not too big, I hope) I can't figure out what if anything I did wrong and did not find anything about problems on the Mac -- TIA for any help Henry Last login: Fri Aug 22 16:07:45 on ttys009 iMac-162:~ hs$ exec '/Applications/Julia-0.3.0.app/Contents/Resources/julia/bin/julia' _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() for help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.0 (2014-08-20 20:43 UTC) _/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release |__/ | x86_64-apple-darwin13.3.0 julia help() Welcome to Julia. The full manual is available at http://docs.julialang.org To get help, try help(function), help(@macro), or help(variable). To search all help text, try apropos(string). julia Pkg.status() ERROR: failed process: Process(`git --git-dir=/Users/hs/.julia/.cache/Stats merge-base 87d1c8d890962dfcfd0b45b82907464787ac7c64 8208e29af9f80ef633e50884ffb17cb25a9f5113`, ProcessExited(1)) [1] in readbytes at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib in readchomp at pkg/git.jl:24 in installed_version at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib in installed at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib in status at pkg/entry.jl:107 in anonymous at pkg/dir.jl:28 in cd at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib in cd at pkg/dir.jl:28 in status at pkg.jl:28 (repeats 2 times) julia Pkg.installed() ERROR: failed process: Process(`git --git-dir=/Users/hs/.julia/.cache/Stats merge-base 87d1c8d890962dfcfd0b45b82907464787ac7c64 8208e29af9f80ef633e50884ffb17cb25a9f5113`, ProcessExited(1)) [1] in readbytes at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib in readchomp at pkg/git.jl:24 in installed_version at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib in installed at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib (repeats 3 times) in anonymous at pkg/dir.jl:28 in cd at /Applications/Julia-0.3.0.app/Contents/Resources/julia/lib/julia/sys.dylib in cd at pkg/dir.jl:28 in installed at pkg.jl:25 julia Pkg.add(Distributions) INFO: Nothing to be done INFO: METADATA is out-of-date — you may not have the latest version of Distributions INFO: Use `Pkg.update()` to get the latest versions of your packages julia julia Pkg.update() INFO: Updating METADATA... INFO: Updating cache of IniFile... INFO: Updating cache of Cairo... INFO: Updating cache of PyPlot... INFO: Updating cache of Debug... INFO: Updating cache of Calculus... INFO: Updating cache of Units... INFO: Updating cache of HDF5... INFO: Updating cache of ICU... INFO: Updating cache of Homebrew... INFO: Updating cache of BinDeps...
[julia-users] Re: Structuring parallel algorithm that iterates on elements of array
You may want to take a look at examples/plife.jl that implements the Game of Life on a distributed array - sounds quite similar to your problem. -viral On Sunday, August 31, 2014 5:35:57 AM UTC+5:30, Spencer Lyon wrote: I often solve fixed point problems where I apply a contraction mapping to an array and`` iterate until convergence. There is nothing in the algorithm that requires the new value at one array index to depend on neighboring indices — only on values obtained at the same index on the previous iteration. It should be quite easy to parallelize each iteration of this algorithm. My question is what the optimal strategy would be for parallelizing the algorithm using the built-in Julia features. If I were using MPI I would simply assign each process a chunk of indices and let them update that portion of the array on each iteration. Would a similar approach be optimal in Julia also? If so, how would I do that? If not, what would be better? To give you an idea of the type of algorithm I am talking about, I have included a working example below (it requires Grid.jl and Optim.jl). I realize that there is a lot of code below, so if it is too long to expect people on this forum to read, please let me know and I will try to condense my code. Thanks! using Grid using Optim #= Computes and returns T^k v, where T is an operator, v is an initial condition and k is the number of iterates. Provided that T is a contraction mapping or similar, T^k v will be an approximation to the fixed point. =# function compute_fixed_point(T::Function, v; err_tol=1e-3, max_iter=50, verbose=true, print_skip=10) iterate = 0 err = err_tol + 1 while iterate max_iter err err_tol new_v = T(v) iterate += 1 err = Base.maxabs(new_v - v) if verbose if iterate % print_skip == 0 println(Compute iterate $iterate with error $err) end end v = new_v end if iterate max_iter verbose println(Converged in $iterate steps) elseif iterate == max_iter warn(max_iter exceeded in compute_fixed_point) end return v end linspace_range(x_min, x_max, n_x) = x_min:(x_max - x_min) / (n_x - 1): x_max type GrowthModel f::Function bet::Real u::Function grid_max::Int grid_size::Int grid::FloatRange end default_f(k) = k^0.65 default_u(c) = log(c) function GrowthModel(f=default_f, bet=0.95, u=default_u, grid_max=2, grid_size=150) grid = linspace_range(1e-6, grid_max, grid_size) return GrowthModel(f, bet, u, grid_max, grid_size, grid) end #= The approximate Bellman operator, which computes and returns the updated value function Tw on the grid points. Could also return the policy function instead if asked. NOTE: this is the function I would like to parallelize =# function bellman_operator!(g::GrowthModel, w::Vector, out::Vector; ret_policy::Bool=false) # Apply linear interpolation to w Aw = CoordInterpGrid(g.grid, w, BCnan, InterpLinear) for (i, k) in enumerate(g.grid) objective(c) = - g.u(c) - g.bet * Aw[g.f(k) - c] res = optimize(objective, 1e-6, g.f(k)) c_star = res.minimum if ret_policy # set the policy equal to the optimal c out[i] = c_star else # set Tw[i] equal to max_c { u(c) + beta w(f(k_i) - c)} out[i] = - objective(c_star) end end return out end function bellman_operator(g::GrowthModel, w::Vector; ret_policy::Bool=false) out = similar(w) bellman_operator!(g, w, out, ret_policy=ret_policy) end gm = GrowthModel() v_init = 5 .* gm.u(gm.grid) .- 25 v_star = compute_fixed_point(x-bellman_operator(gm, x), v_init, max_iter=1000, err_tol=1e-7)
[julia-users] Re: Problem creating graphs
This is perhaps also best filed as an issue against Graphs.jl. -viral On Friday, August 29, 2014 10:20:07 PM UTC+5:30, Ivan Raikov wrote: Hello, I am trying to create a graph with 10500 vertices, and random connections with uniform probability of 0.1, using Julia 0.3 and the Graphs package. The code below seems to run out of memory when it reaches i ~ 1. Am I doing something wrong here? using Graphs n = 10500 p = 0.1 function build(n,p) gEx = graph([ ExVertex(x,string(x)) for x = 1:n ], ExEdge{ExVertex}[]) V = vertices(gEx) eind = 1 for i = 1 : n println (i = , i) for j = 1 : n if rand() p d = AttributeDict () d[utf8(weight)] = 0.1 add_edge! (gEx, ExEdge (eind, V[i], V[j], d)) eind = eind + 1 end end end println (gEx) gEx end build(n,p)
Re: [julia-users] Sharing success: running Julia on PBS cluster across compute nodes
The goal certainly is to maintain it. I will request nlhepler to see if he can transfer the repo to JuliaLang, which will help with maintenance. -viral On Thursday, August 28, 2014 4:05:27 PM UTC+5:30, Florian Oswald wrote: I'm mentioning this because we there's a dangling issue on the topic since 24 of May: https://github.com/nlhepler/ClusterManagers.jl/issues/13 On 28 August 2014 10:53, Florian Oswald florian.osw...@gmail.com wrote: no problem about adding this to clustermanagers.jl. just one question: is that repo still maintained? it seemed there was very little activity there recently. i can submit a PR there if that's the preferred solution. On 28 August 2014 00:38, Stefan Karpinski ste...@karpinski.org wrote: That's cool. It would be great if we can extract the parts of this that are not specific to the particular system you're running on and generic to PBS and added it to the ClusterManagers package. Thanks also for reporting your success story – it's always nice to hear them, regardless of magnitude :-) On Wed, Aug 27, 2014 at 6:38 PM, Florian Oswald florian.osw...@gmail.com wrote: Dear All, after bugging this list long enough with questions about how to get Julia running in parallel on a Torque/PBS managed cluster I thought I'd share my experience with the list. I realise that by julia standards this is a rather modest achievement, but I'd been happy to come across something like this post a while ago. :-) So, there's nothing special about the cluster being PBS managed (rather than SGE or whatever), I just found that each system is as idiosyncratic as the sysadmin person who set it up (starting from the format of nodenames to scheduler options to how environment variables get forwarded into a node, etc etc), so it always takes a fair amount of hacking to get something running. It's pretty low quality hacking I would say, but it's painful on a cluster. You basically need to adapt the functions in iridis_launcher.jl in the below repo to your system. Very few of the issues actually had anything to do with Julia itself, so I tried to explain as much about the environment as possible. Again, just sharing this in the hope someone out there is trying to achieve something similar may find this useful: https://github.com/floswald/parallelTest/tree/master/julia/iridis
[julia-users] Re: Any method to save the variables in workspace to file?
This is an old thread but I needed something similar to the original poster and didn't want to depend on external packages. A quick and dirty solution can be to save to file with showall and then eval and parse back in. This works for the built-in data types and for small data but I'm sure there are many disadvantages... Anyway, I've found it useful in small scripts that need to save some state between runs. Code and example below. Regards, /Robert Feldt macro savevars(filename, vars...) printexprs = map(vars) do var :(print(f, ;, $(string(var)), = ); showall(f, $(esc(var end quote local f = open($(esc(filename)), w) try $(Expr(:block, printexprs...)) finally close(f) end end end a = 1 b = 2.345 c = [1,2,3] d = {:a = a, :b = 1, c = arne, d1 = {1 = 2}} @savevars(t, a, b, c, d) function loadvars(filename) f = open(filename, r) try eval(parse(readall(f))) finally close(f) end end a = b = c = d = -1 loadvars(t) julia a 1 julia b 2.345 julia c 3-element Array{Int64,1}: 1 2 3 julia d Dict{Any,Any} with 4 entries: :b = 1 c = arne d1 = {1=2} :a = a Den tisdagen den 1:e april 2014 kl. 14:41:53 UTC+2 skrev Freddy Chua: in matlab, there's save and load in java, there's object serialization So does julia have this feature?
Re: [julia-users] Re: sortperm(vec(F),rev=true) ; ERROR: stack overflow
soryy but vector is lost ... My version: _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() to list help topics | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.0-prerelease+3687 (2014-06-16 00:19 UTC) _/ |\__'_|_|_|\__'_| | Commit 9381e34 (76 days old master) |__/ | x86_64-w64-mingw32 julia using HDF5 Warning: using HDF5.parent in module Main conflicts with an existing identifier. Warning: using HDF5.has in module Main conflicts with an existing identifier. julia Paul W dniu 2014-08-30 16:35, Viral Shah pisze: Could you file this as an issue? Which version of Julia are you using and what platform? It doesn't fail for me. -viral On Friday, August 29, 2014 11:54:16 PM UTC+5:30, paul analyst wrote: julia F 5932868x1 Array{Float64,2}: 0.00168482 -0.00408837 -0.00408837 -0.109945 -0.00408837 -0.00408837 -0.00408837 -0.148809 -0.00782675 -0.00408837 ? -0.00408837 -0.00408837 0.498521 -0.00297856 -0.0859596 -0.0760184 -0.0706045 0.420753 0.299376 0.00371405 julia p=sortperm(vec(F),rev=true) ERROR: stack overflow
Re: [julia-users] julia WebSocket receiving but not sending binary data.
Hey, it looks like WebSockets.jl wasn't setting the right flags in WebSocket packets for binary data. This patch makes your code work https://github.com/JuliaWeb/WebSockets.jl/pull/16 :) On Mon, Aug 25, 2014 at 6:53 PM, Altieres Del-Sent altieresdels...@gmail.com wrote: HI, I am testing the websocket because I want to use it to send e receive binary data. So far the sending from browser to client has worked but the sending from the server to the client ( more important) it's not, it gives me the message. I will probably will switch to a base64, but anyone has anyidea how to solve that? ERROR: read: end of file in read at iobuffer.jl:68 in read at stream.jl:641 in write at stream.jl:749 in read_frame at C:\Users\altieres\.julia\WebSockets\src\WebSockets.jl:189 I have the follow code in the server using HttpServer using WebSockets wsh = WebSocketHandler() do req,client while true msg = read(client) floatArray = reinterpret(Float64,msg) for t in floatArray print(t) print(\n) end write(client, reinterpret(Uint8,[1.0,2.0,3.0])) end end server = Server(wsh) run(server,8090) and the follow in the cliente... html head titleTODO supply a title/title meta charset=UTF-8 meta name=viewport content=width=device-width, initial-scale=1.0 script var ws = new WebSocket(ws://localhost:8090); ws.onmessage = function(msg) { var result = new Float64Array(msg.data); var str = ; for(var i = 0; i result.length;i++) { str += result[i]; } document.getElementById(log).textContent = str; }; ws.onopen = function (event) { var array = new Float64Array(300); for(var i = 0; i 300; i++) { array[i] = i; } ws.send(array); }; /script /head body div id=logTODO write content/div /body /html
[julia-users] Memory considerations for performance
I just found this interesting article about garbage collection: http://people.cs.umass.edu/~emery/pubs/gcvsmalloc.pdf Turns out GC can significantly affect performance when memory available is ~3X the needed memory (for e.g. because a GC touches more memory pages relative to manual handling it can trigger more caching) So maybe such a benchamrk, which checks how much available memory there is and then use say 75% of it, would be very useful. I don't believe there is such benchmark now, am I right? of course, maybe just allocating all the needed memory at start would solve the problem (if any). The benchamrk would have to be written in a natural, Julian way, just like the non-vectorized benchamrks for the other languages. The purpose would be to reveal useful performance information, for e.g. to understand if indeed allocating everything up-front is really needed Maybe I'll write these myself. Just sharing some thoughts :)
Re: [julia-users] Re: Installing Julia on Mac
This is because your GCC is out of date. Brew upgrade and try again. On Aug 30, 2014 9:14 PM, ron...@gmail.com wrote: I didn't know there was a Homebrew Tap for Julia. But thanks to this post, I found it: *brew tap staticfloat/julia* So that's really cool. I prefer to have all my add-on software managed via Homebrew, if possible. So I tried installing gcc Julia, as per above, but seem to be missing a Fortran library: *== make -C contrib -f repackage_system_suitesparse4.make prefix=/usr/local/Cellar/julia/0.3.0 USE_BLAS64=0 FC=/usr/local/bin/gfortran LLV* * clang++ -stdlib=libc++ -mmacosx-version-min=10.7 -m64 -shared -Xlinker -all_load /usr/local/opt/suite-sparse-julia/lib/libsuitesparseconfig.a /usr/local/opt/suite-sparse-julia/lib/libspqr.a -o /private/tmp/julia-0p1Hpa/usr/lib/libspqr.dylib -L/private/tmp/julia-0p1Hpa/usr/lib -L/usr/local/opt/suite-sparse-julia/lib -L/usr/local/opt/arpack-julia/lib -L/usr/local/opt/openblas-julia/lib -L/usr/local/opt/llvm33-julia/lib -L/usr/local/opt/libffi/lib -L/usr/local/opt/cloog018-julia/lib -L/usr/local/opt/isl011-julia/lib -L/usr/local/opt/gmp4-julia/lib -L/usr/local/lib -F/usr/local/Frameworks -Wl,-headerpad_max_install_names -headerpad_max_install_names -lcholmod -lcolamd -lamd -lopenblas -Wl,-rpath,'@loader_path/' \* * install_name_tool -id @rpath/libspqr.dylib /private/tmp/julia-0p1Hpa/usr/lib/libspqr.dylib* *ld: file not found: /usr/local/lib/gcc/x86_64-apple-darwin13.3.0/4.9.1/libgfortran.3.dylib for architecture x86_64* *clang: error: linker command failed with exit code 1 (use -v to see invocation)* *make: *** [default] Error 1* I thought that Homebrew took care of dependencies, so that anything missing would be installed first, if necessary. Maybe this doesn't work with 'unofficial' taps? Confused. . .
[julia-users] Calling Julia from Python
I will give a talk on Julia in front of a group of Python users. The presentation will make use of IJulia and the IPython notebook, and everything works really nice, including calling Python from Julia. To make it even relevant for Python people I would like to show how to call Julia from Python. So I installed the julia Python package within IJulia: cd ~/.julia/v0.3/IJulia/python sudo python setup.py install After that, when calling Julia I get from julia import Julia j = Julia() ... ValueError: Julia release library not found searched /usr/lib/libjulia.so and /usr/lib/libjulia.dylib I can correct this in file .../site-packages/julia/core.py manually to find this library at /usr/lib/x86_64-linux-gnu/julia/libjulia.so: from julia import Julia j = Julia() System image file /usr/bin/../lib/julia/sys.ji not found and here, I apologize, I gave up. (I tried the pyjulia Python package, too, but was not more successful.) I am ready to install everything anew, Python, Julia, ..., but I have no idea what to do differently this time. [Versioninfo: Ubuntu Linux 14.04, Python 2.7.6, Julia 0.3.0 latest]
[julia-users] Calling Julia from Python
It works for me on my Mac. Can you file a pyjulia issue?
Re: [julia-users] julia WebSocket receiving but not sending binary data.
thank you :), I will test and see if it works. 2014-08-31 6:11 GMT-03:00 Shashi Gowda shashigowd...@gmail.com: Hey, it looks like WebSockets.jl wasn't setting the right flags in WebSocket packets for binary data. This patch makes your code work https://github.com/JuliaWeb/WebSockets.jl/pull/16 :) On Mon, Aug 25, 2014 at 6:53 PM, Altieres Del-Sent altieresdels...@gmail.com wrote: HI, I am testing the websocket because I want to use it to send e receive binary data. So far the sending from browser to client has worked but the sending from the server to the client ( more important) it's not, it gives me the message. I will probably will switch to a base64, but anyone has anyidea how to solve that? ERROR: read: end of file in read at iobuffer.jl:68 in read at stream.jl:641 in write at stream.jl:749 in read_frame at C:\Users\altieres\.julia\WebSockets\src\WebSockets.jl:189 I have the follow code in the server using HttpServer using WebSockets wsh = WebSocketHandler() do req,client while true msg = read(client) floatArray = reinterpret(Float64,msg) for t in floatArray print(t) print(\n) end write(client, reinterpret(Uint8,[1.0,2.0,3.0])) end end server = Server(wsh) run(server,8090) and the follow in the cliente... html head titleTODO supply a title/title meta charset=UTF-8 meta name=viewport content=width=device-width, initial-scale=1.0 script var ws = new WebSocket(ws://localhost:8090); ws.onmessage = function(msg) { var result = new Float64Array(msg.data); var str = ; for(var i = 0; i result.length;i++) { str += result[i]; } document.getElementById(log).textContent = str; }; ws.onopen = function (event) { var array = new Float64Array(300); for(var i = 0; i 300; i++) { array[i] = i; } ws.send(array); }; /script /head body div id=logTODO write content/div /body /html
[julia-users] trouble after updating Julia
Hi all! I am having problems in updating Julia from the git. As usual, every three four days I download the last updates from the git and compile them, this is what I do (I'm running ubuntu with KDE, and Julia is v0.4) from the source directory I typed git pull make then I got this ... ... ... iterator.jl inference.jl ERROR: LoadError(/usr/local/julia/v0.4/base/sysimg.jl,65,LoadError( inference.jl,134,UndefVarError(:sizeof))) in include at ./boot.jl:245 (repeats 2 times) in include_from_node1 at loading.jl:128 in process_options at ./client.jl:285 in _start at ./client.jl:354 in _start_3B_13569 at /usr/local/julia/v0.4/usr/lib/julia/sys.so *** This error is usually fixed by running 'make clean'. If the error persists, try 'make cleanall'. *** make[1]: *** [/usr/local/julia/v0.4/usr/lib/julia/sys.o] Error 1 make: *** [release] Error 2 after doing the make cleanall, tried make again and got ... ... ... /usr/bin/install -c -m 644 '_U_dyn_register.man' '/usr/local/julia/v0.4/usr/share/man/man3/_U_dyn_register.3' /usr/bin/install -c -m 644 '_U_dyn_cancel.man' '/usr/local/julia/v0.4/usr/share/man/man3/_U_dyn_cancel.3' /usr/bin/install -c -m 644 include/libunwind-dynamic.h include/libunwind- ptrace.h include/libunwind-coredump.h include/libunwind-x86_64.h include/ libunwind.h include/unwind.h '/usr/local/julia/v0.4/usr/include' /usr/bin/install -c -m 644 include/libunwind-common.h '/usr/local/julia/v0.4/usr/include' Makefile:141: /Makefile.rules: No such file or directory make[3]: *** No rule to make target `/Makefile.rules'. Stop. make[2]: *** [/usr/local/julia/v0.4/usr/lib/libLLVMJIT.a] Error 2 make[1]: *** [julia-release] Error 2 make: *** [release] Error 2 now I'm stucked, I looked on the internet but could find reason or solutions for this, it happened before and I had to remove everything and download and make everything from scratch, does anybody know how it is possible to fix this without completely reinstalling Julia?? thanks! andrea
[julia-users] List of useful macros for beginners?
For example, the Julia manual illustrates the usage of @inbound and @simd as performance tips. Can anyone provide a short list of macros with examples besides these two?
Re: [julia-users] Blas trsv function: Argument mismatch between function and documentation (?)
How about posting text on gist.github.com or something like that? Or maybe just a small snippet inline in an email indicating the problem? On Aug 30, 2014, at 5:03 PM, John Myles White johnmyleswh...@gmail.com wrote: I can’t speak for others, but I’m very hesitant to download any kind of files from mailing lists. — John On Aug 30, 2014, at 2:00 PM, asim yahooans...@gmail.com wrote: Would this help? Asim On Saturday, August 30, 2014 4:49:23 PM UTC-4, John Myles White wrote: Hi Asim, It’s a little hard to work with PDF’s. Would you consider using Gists? (https://gist.github.com) — John On Aug 30, 2014, at 1:47 PM, asim yahoo...@gmail.com wrote: Hi The Blas trsv function is described as needing 7 arguments in the documentation. However, it only appears to work with 5 arguments. The attached notebook illustrates the behavior Asim trsvNotebook.pdf trsv.ipynb
Re: [julia-users] Any method to save the variables in workspace to file?
Hi Robert, You and the OP will have to check whether this addresses you use case, but did you see this recent message: https://groups.google.com/forum/m/#!topic/julia-users/yHXjH7b7r1o Cheers, Kevin On Sunday, August 31, 2014, Robert Feldt robert.fe...@gmail.com wrote: This is an old thread but I needed something similar to the original poster and didn't want to depend on external packages. A quick and dirty solution can be to save to file with showall and then eval and parse back in. This works for the built-in data types and for small data but I'm sure there are many disadvantages... Anyway, I've found it useful in small scripts that need to save some state between runs. Code and example below. Regards, /Robert Feldt macro savevars(filename, vars...) printexprs = map(vars) do var :(print(f, ;, $(string(var)), = ); showall(f, $(esc(var end quote local f = open($(esc(filename)), w) try $(Expr(:block, printexprs...)) finally close(f) end end end a = 1 b = 2.345 c = [1,2,3] d = {:a = a, :b = 1, c = arne, d1 = {1 = 2}} @savevars(t, a, b, c, d) function loadvars(filename) f = open(filename, r) try eval(parse(readall(f))) finally close(f) end end a = b = c = d = -1 loadvars(t) julia a 1 julia b 2.345 julia c 3-element Array{Int64,1}: 1 2 3 julia d Dict{Any,Any} with 4 entries: :b = 1 c = arne d1 = {1=2} :a = a Den tisdagen den 1:e april 2014 kl. 14:41:53 UTC+2 skrev Freddy Chua: in matlab, there's save and load in java, there's object serialization So does julia have this feature?
Re: [julia-users] List of useful macros for beginners?
@show and @which are two other common ones. There are examples of how to use them in this blog post: http://www.juliabloggers.com/julia-helps/ (- I wrote this blog post.) Are you looking for examples of macros you would want to use or examples of macros to help you write your own macros? -- Leah On Sun, Aug 31, 2014 at 8:47 AM, Xiaowei Zhang xiaowei.w.zh...@gmail.com wrote: For example, the Julia manual illustrates the usage of @inbound and @simd as performance tips. Can anyone provide a short list of macros with examples besides these two?
[julia-users] Has anyone successfully performed probit or logit regression in Julia?
Has anyone successfully performed probit or logit regression in Julia? The GLM documentation https://github.com/JuliaStats/GLM.jl does not provide a generalizable example of how to use glm(). It gives a Poisson example without any suggestion of how to switch from Poisson to some other type. *Using the Poisson example from GLM documentation works:* julia X = [1;2;3.] julia Y = [1;0;1.] julia data = DataFrame(X=X,Y=Y) julia fit(GeneralizedLinearModel, Y ~ X,data, Poisson()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) -0.405465 1.87034 -0.216787 0.8284 X -3.91448e-17 0.8658 -4.52123e-17 1. *But does not generalize:* julia fit(GeneralizedLinearModel, Y ~ X ,data, Logit()) ERROR: Logit not defined julia fit(GeneralizedLinearModel, Y ~ X, data, link=:ProbitLink) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) julia fit(GeneralizedLinearModel, Y ~ X, data, family=binomial,link=probit) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) and a dozen other similar attempts fail. Thanks, Bradley
Re: [julia-users] Blas trsv function: Argument mismatch between function and documentation (?)
Fixed by caf2814b3f2706efbc59382da2aa6461894a06e1 Med venlig hilsen Andreas Noack 2014-08-31 10:01 GMT-04:00 Stefan Karpinski stefan.karpin...@gmail.com: How about posting text on gist.github.com or something like that? Or maybe just a small snippet inline in an email indicating the problem? On Aug 30, 2014, at 5:03 PM, John Myles White johnmyleswh...@gmail.com wrote: I can’t speak for others, but I’m very hesitant to download any kind of files from mailing lists. — John On Aug 30, 2014, at 2:00 PM, asim yahooans...@gmail.com wrote: Would this help? Asim On Saturday, August 30, 2014 4:49:23 PM UTC-4, John Myles White wrote: Hi Asim, It’s a little hard to work with PDF’s. Would you consider using Gists? ( https://gist.github.com) — John On Aug 30, 2014, at 1:47 PM, asim yahoo...@gmail.com wrote: Hi The Blas trsv function is described as needing 7 arguments in the documentation. However, it only appears to work with 5 arguments. The attached notebook illustrates the behavior Asim trsvNotebook.pdf trsv.ipynb
[julia-users] Issue Replacing NaN with 0
Hi Everyone, I cannot figure out if there is an error in Julia or (more likely) in my code. I have a matrix A, which contains some NaN values and I would like to create a copy of it that is the same except that I replace the NaN values with 0's. I would also like to do this without altering the original matrix. I have tried two different approaches, both of which have the same whacky result. Where no matter what I do, the original values seem to be altered in A. My results would ideally look like: a =[1 2 3; 4 5 NaN] and x=[1 2 3; 4 5 0] Please let me know where my error is or if this is some oddity of julia's handling of NaN's. The same logic of code works perfectly in Matlab, so I'm really confused as to what the error is. Thanks!! *Method 1:* a=[1 2 3; 4 5 NaN] x=a for m=1:size(x,1) for l=1:size(x,2) isnan(x[m,l]) ? x[m,l]=0 : x[m,l]=x[m,l] end end Result: julia a 2x3 Array{Float64,2}: 1.0 2.0 3.0 4.0 5.0 0.0 julia x 2x3 Array{Float64,2}: 1.0 2.0 3.0 4.0 5.0 0.0 *Method 2:* julia a=[1 2 3; 4 5 NaN] 2x3 Array{Float64,2}: 1.0 2.03.0 4.0 5.0 NaN julia x=a 2x3 Array{Float64,2}: 1.0 2.03.0 4.0 5.0 NaN julia x[isnan(x)]=0 0 julia x 2x3 Array{Float64,2}: 1.0 2.0 3.0 4.0 5.0 0.0 julia a 2x3 Array{Float64,2}: 1.0 2.0 3.0 4.0 5.0 0.0
[julia-users] Re: Has anyone successfully performed probit or logit regression in Julia?
This works for me: ``` *julia **fit(GeneralizedLinearModel,Y~X,data,Binomial(),ProbitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* *Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.430727 1.980190.217518 0.8278* *X2.37745e-17 0.91665 2.59362e-17 1.* *julia **fit(GeneralizedLinearModel,Y~X,data,Binomial(),LogitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* * Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.693147 3.24037 0.21391 0.8306* *X-7.44332e-17 1.5 -4.96221e-17 1.* *```* On Sunday, August 31, 2014 1:27:15 PM UTC-4, Bradley Setzler wrote: Has anyone successfully performed probit or logit regression in Julia? The GLM documentation https://github.com/JuliaStats/GLM.jl does not provide a generalizable example of how to use glm(). It gives a Poisson example without any suggestion of how to switch from Poisson to some other type. *Using the Poisson example from GLM documentation works:* julia X = [1;2;3.] julia Y = [1;0;1.] julia data = DataFrame(X=X,Y=Y) julia fit(GeneralizedLinearModel, Y ~ X,data, Poisson()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) -0.405465 1.87034 -0.216787 0.8284 X -3.91448e-17 0.8658 -4.52123e-17 1. *But does not generalize:* julia fit(GeneralizedLinearModel, Y ~ X ,data, Logit()) ERROR: Logit not defined julia fit(GeneralizedLinearModel, Y ~ X, data, link=:ProbitLink) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) julia fit(GeneralizedLinearModel, Y ~ X, data, family=binomial,link=probit) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) and a dozen other similar attempts fail. Thanks, Bradley
Re: [julia-users] Issue Replacing NaN with 0
Try x=copy(a). Matlab automatically copies the array if it's written to. On Sun, Aug 31, 2014 at 1:52 PM, Alex Hollingsworth hollina...@gmail.com wrote: Hi Everyone, I cannot figure out if there is an error in Julia or (more likely) in my code. I have a matrix A, which contains some NaN values and I would like to create a copy of it that is the same except that I replace the NaN values with 0's. I would also like to do this without altering the original matrix. I have tried two different approaches, both of which have the same whacky result. Where no matter what I do, the original values seem to be altered in A. My results would ideally look like: a =[1 2 3; 4 5 NaN] and x=[1 2 3; 4 5 0] Please let me know where my error is or if this is some oddity of julia's handling of NaN's. The same logic of code works perfectly in Matlab, so I'm really confused as to what the error is. Thanks!! Method 1: a=[1 2 3; 4 5 NaN] x=a for m=1:size(x,1) for l=1:size(x,2) isnan(x[m,l]) ? x[m,l]=0 : x[m,l]=x[m,l] end end Result: julia a 2x3 Array{Float64,2}: 1.0 2.0 3.0 4.0 5.0 0.0 julia x 2x3 Array{Float64,2}: 1.0 2.0 3.0 4.0 5.0 0.0 Method 2: julia a=[1 2 3; 4 5 NaN] 2x3 Array{Float64,2}: 1.0 2.03.0 4.0 5.0 NaN julia x=a 2x3 Array{Float64,2}: 1.0 2.03.0 4.0 5.0 NaN julia x[isnan(x)]=0 0 julia x 2x3 Array{Float64,2}: 1.0 2.0 3.0 4.0 5.0 0.0 julia a 2x3 Array{Float64,2}: 1.0 2.0 3.0 4.0 5.0 0.0
Re: [julia-users] Re: sortperm(vec(F),rev=true) ; ERROR: stack overflow
Maybe upgrade to 0.3.0 release? On Sunday, August 31, 2014 5:35:32 AM UTC-4, paul analyst wrote: soryy but vector is lost ... My version: _ _ _ _(_)_ | A fresh approach to technical computing (_) | (_) (_)| Documentation: http://docs.julialang.org _ _ _| |_ __ _ | Type help() to list help topics | | | | | | |/ _` | | | | |_| | | | (_| | | Version 0.3.0-prerelease+3687 (2014-06-16 00:19 UTC) _/ |\__'_|_|_|\__'_| | Commit 9381e34 (76 days old master) |__/ | x86_64-w64-mingw32 julia using HDF5 Warning: using HDF5.parent in module Main conflicts with an existing identifier. Warning: using HDF5.has in module Main conflicts with an existing identifier. julia Paul W dniu 2014-08-30 16:35, Viral Shah pisze: Could you file this as an issue? Which version of Julia are you using and what platform? It doesn't fail for me. -viral On Friday, August 29, 2014 11:54:16 PM UTC+5:30, paul analyst wrote: julia F 5932868x1 Array{Float64,2}: 0.00168482 -0.00408837 -0.00408837 -0.109945 -0.00408837 -0.00408837 -0.00408837 -0.148809 -0.00782675 -0.00408837 ? -0.00408837 -0.00408837 0.498521 -0.00297856 -0.0859596 -0.0760184 -0.0706045 0.420753 0.299376 0.00371405 julia p=sortperm(vec(F),rev=true) ERROR: stack overflow
Re: [julia-users] Issue Replacing NaN with 0
I've come to wish that in cases like this (and in vec, reshape and soon-to-be slicing) the resulting type clearly shows the user it is a ArrayView, SubArray or something like AliasArray. I've never like the invisible fusing of variables in Python and since Julia's type system is so expressive I figure it's the perfect way to illustrates some of the virtues of Julia's design ( ie inviting to beginners but deep power). Anyhoo, sorry for the rant. Love the language. Cheers.
[julia-users] Re: Has anyone successfully performed probit or logit regression in Julia?
Thank you Adam, this works. Let me suggest that this information be included in the GLM documentation: To fit a GLM model, use the function, glm(formula, data, family, link), where, - formula uses column symbols from the DataFrame data, e.g., if names(data)=[:Y,:X], then a valid formula is Y~X; - data is a DataFrame which may contain NA values, the rows with NA values will be ignored (apparently); - family may be chosen from Binomial(), Gamma(), Normal(), or Poisson(), and the parentheses are required; and, - link may be chosen from the list in the GLM documentation, such as LogitLink(), and again the parentheses are required. For some families, a default link is available so the link argument may be left blank. Bradley On Sunday, August 31, 2014 12:56:19 PM UTC-5, Adam Kapor wrote: This works for me: ``` *julia **fit(GeneralizedLinearModel,Y~X,data,Binomial(),ProbitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* *Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.430727 1.980190.217518 0.8278* *X2.37745e-17 0.91665 2.59362e-17 1.* *julia **fit(GeneralizedLinearModel,Y~X,data,Binomial(),LogitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* * Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.693147 3.24037 0.21391 0.8306* *X-7.44332e-17 1.5 -4.96221e-17 1.* *```* On Sunday, August 31, 2014 1:27:15 PM UTC-4, Bradley Setzler wrote: Has anyone successfully performed probit or logit regression in Julia? The GLM documentation https://github.com/JuliaStats/GLM.jl does not provide a generalizable example of how to use glm(). It gives a Poisson example without any suggestion of how to switch from Poisson to some other type. *Using the Poisson example from GLM documentation works:* julia X = [1;2;3.] julia Y = [1;0;1.] julia data = DataFrame(X=X,Y=Y) julia fit(GeneralizedLinearModel, Y ~ X,data, Poisson()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) -0.405465 1.87034 -0.216787 0.8284 X -3.91448e-17 0.8658 -4.52123e-17 1. *But does not generalize:* julia fit(GeneralizedLinearModel, Y ~ X ,data, Logit()) ERROR: Logit not defined julia fit(GeneralizedLinearModel, Y ~ X, data, link=:ProbitLink) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) julia fit(GeneralizedLinearModel, Y ~ X, data, family=binomial,link=probit) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) and a dozen other similar attempts fail. Thanks, Bradley
Re: [julia-users] Issue Replacing NaN with 0
I don’t think this example had any views. Both bindings had an equal right to be considered the true binding. I think we’re better off doing more education to teach people to distinguish bindings and values. — John On Aug 31, 2014, at 11:27 AM, Ethan Anderes ethanande...@gmail.com wrote: I've come to wish that in cases like this (and in vec, reshape and soon-to-be slicing) the resulting type clearly shows the user it is a ArrayView, SubArray or something like AliasArray. I've never like the invisible fusing of variables in Python and since Julia's type system is so expressive I figure it's the perfect way to illustrates some of the virtues of Julia's design ( ie inviting to beginners but deep power). Anyhoo, sorry for the rant. Love the language. Cheers.
Re: [julia-users] Re: Has anyone successfully performed probit or logit regression in Julia?
Bradley, it’s especially easy to edit documentation because you can make a Pull Request right from the website. — John On Aug 31, 2014, at 11:30 AM, Bradley Setzler bradley.setz...@gmail.com wrote: Thank you Adam, this works. Let me suggest that this information be included in the GLM documentation: To fit a GLM model, use the function, glm(formula, data, family, link), where, - formula uses column symbols from the DataFrame data, e.g., if names(data)=[:Y,:X], then a valid formula is Y~X; - data is a DataFrame which may contain NA values, the rows with NA values will be ignored (apparently); - family may be chosen from Binomial(), Gamma(), Normal(), or Poisson(), and the parentheses are required; and, - link may be chosen from the list in the GLM documentation, such as LogitLink(), and again the parentheses are required. For some families, a default link is available so the link argument may be left blank. Bradley On Sunday, August 31, 2014 12:56:19 PM UTC-5, Adam Kapor wrote: This works for me: ``` julia fit(GeneralizedLinearModel,Y~X,data,Binomial(),ProbitLink()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) 0.430727 1.980190.217518 0.8278 X2.37745e-17 0.91665 2.59362e-17 1. julia fit(GeneralizedLinearModel,Y~X,data,Binomial(),LogitLink()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) 0.693147 3.24037 0.21391 0.8306 X-7.44332e-17 1.5 -4.96221e-17 1. ``` On Sunday, August 31, 2014 1:27:15 PM UTC-4, Bradley Setzler wrote: Has anyone successfully performed probit or logit regression in Julia? The GLM documentation does not provide a generalizable example of how to use glm(). It gives a Poisson example without any suggestion of how to switch from Poisson to some other type. Using the Poisson example from GLM documentation works: julia X = [1;2;3.] julia Y = [1;0;1.] julia data = DataFrame(X=X,Y=Y) julia fit(GeneralizedLinearModel, Y ~ X,data, Poisson()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) -0.405465 1.87034 -0.216787 0.8284 X -3.91448e-17 0.8658 -4.52123e-17 1. But does not generalize: julia fit(GeneralizedLinearModel, Y ~ X ,data, Logit()) ERROR: Logit not defined julia fit(GeneralizedLinearModel, Y ~ X, data, link=:ProbitLink) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) julia fit(GeneralizedLinearModel, Y ~ X, data, family=binomial,link=probit) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) and a dozen other similar attempts fail. Thanks, Bradley
Re: [julia-users] Issue Replacing NaN with 0
Yeah, I can see your point John. It's probably not reasonable to make a new AliasedArray type. For me I think the education would address the difference between vec, for example, when used inside another function, eg x = sin(vec(a)), or the memory overlap case, eg x = vec(a). This stung me at one point. When ArrayViews lands as slicing in Base I should take a shot at a PR for the docs. Cheers
Re: [julia-users] Blas trsv function: Argument mismatch between function and documentation (?)
For those who does not know how to lookup a git sha, here is the github link: https://github.com/JuliaLang/julia/commit/caf2814b3f2706efbc59382da2aa6461894a06e1 kl. 19:40:19 UTC+2 søndag 31. august 2014 skrev Andreas Noack følgende: Fixed by caf2814b3f2706efbc59382da2aa6461894a06e1 Med venlig hilsen Andreas Noack 2014-08-31 10:01 GMT-04:00 Stefan Karpinski stefan.k...@gmail.com javascript:: How about posting text on gist.github.com or something like that? Or maybe just a small snippet inline in an email indicating the problem? On Aug 30, 2014, at 5:03 PM, John Myles White johnmyl...@gmail.com javascript: wrote: I can’t speak for others, but I’m very hesitant to download any kind of files from mailing lists. — John On Aug 30, 2014, at 2:00 PM, asim yahoo...@gmail.com javascript: wrote: Would this help? Asim On Saturday, August 30, 2014 4:49:23 PM UTC-4, John Myles White wrote: Hi Asim, It’s a little hard to work with PDF’s. Would you consider using Gists? ( https://gist.github.com) — John On Aug 30, 2014, at 1:47 PM, asim yahoo...@gmail.com wrote: Hi The Blas trsv function is described as needing 7 arguments in the documentation. However, it only appears to work with 5 arguments. The attached notebook illustrates the behavior Asim trsvNotebook.pdf trsv.ipynb
Re: [julia-users] Blas trsv function: Argument mismatch between function and documentation (?)
Oh right. They don't become links automatically on the list. Med venlig hilsen Andreas Noack 2014-08-31 15:25 GMT-04:00 Ivar Nesje iva...@gmail.com: For those who does not know how to lookup a git sha, here is the github link: https://github.com/JuliaLang/julia/commit/caf2814b3f2706efbc59382da2aa6461894a06e1 kl. 19:40:19 UTC+2 søndag 31. august 2014 skrev Andreas Noack følgende: Fixed by caf2814b3f2706efbc59382da2aa6461894a06e1 Med venlig hilsen Andreas Noack 2014-08-31 10:01 GMT-04:00 Stefan Karpinski stefan.k...@gmail.com: How about posting text on gist.github.com or something like that? Or maybe just a small snippet inline in an email indicating the problem? On Aug 30, 2014, at 5:03 PM, John Myles White johnmyl...@gmail.com wrote: I can’t speak for others, but I’m very hesitant to download any kind of files from mailing lists. — John On Aug 30, 2014, at 2:00 PM, asim yahoo...@gmail.com wrote: Would this help? Asim On Saturday, August 30, 2014 4:49:23 PM UTC-4, John Myles White wrote: Hi Asim, It’s a little hard to work with PDF’s. Would you consider using Gists? ( https://gist.github.com) — John On Aug 30, 2014, at 1:47 PM, asim yahoo...@gmail.com wrote: Hi The Blas trsv function is described as needing 7 arguments in the documentation. However, it only appears to work with 5 arguments. The attached notebook illustrates the behavior Asim trsvNotebook.pdf trsv.ipynb
Re: [julia-users] Re: Has anyone successfully performed probit or logit regression in Julia?
Thank you for suggesting this, John. https://github.com/JuliaStats/GLM.jl/pull/90 Bradley On Sunday, August 31, 2014 1:33:04 PM UTC-5, John Myles White wrote: Bradley, it’s especially easy to edit documentation because you can make a Pull Request right from the website. — John On Aug 31, 2014, at 11:30 AM, Bradley Setzler bradley...@gmail.com javascript: wrote: Thank you Adam, this works. Let me suggest that this information be included in the GLM documentation: To fit a GLM model, use the function, glm(formula, data, family, link), where, - formula uses column symbols from the DataFrame data, e.g., if names(data)=[:Y,:X], then a valid formula is Y~X; - data is a DataFrame which may contain NA values, the rows with NA values will be ignored (apparently); - family may be chosen from Binomial(), Gamma(), Normal(), or Poisson(), and the parentheses are required; and, - link may be chosen from the list in the GLM documentation, such as LogitLink(), and again the parentheses are required. For some families, a default link is available so the link argument may be left blank. Bradley On Sunday, August 31, 2014 12:56:19 PM UTC-5, Adam Kapor wrote: This works for me: ``` *julia **fit(GeneralizedLinearModel,Y~X,data,Binomial(),ProbitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* *Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.430727 1.980190.217518 0.8278* *X2.37745e-17 0.91665 2.59362e-17 1.* *julia **fit(GeneralizedLinearModel,Y~X,data,Binomial(),LogitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* * Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.693147 3.24037 0.21391 0.8306* *X-7.44332e-17 1.5 -4.96221e-17 1.* *```* On Sunday, August 31, 2014 1:27:15 PM UTC-4, Bradley Setzler wrote: Has anyone successfully performed probit or logit regression in Julia? The GLM documentation https://github.com/JuliaStats/GLM.jl does not provide a generalizable example of how to use glm(). It gives a Poisson example without any suggestion of how to switch from Poisson to some other type. *Using the Poisson example from GLM documentation works:* julia X = [1;2;3.] julia Y = [1;0;1.] julia data = DataFrame(X=X,Y=Y) julia fit(GeneralizedLinearModel, Y ~ X,data, Poisson()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) -0.405465 1.87034 -0.216787 0.8284 X -3.91448e-17 0.8658 -4.52123e-17 1. *But does not generalize:* julia fit(GeneralizedLinearModel, Y ~ X ,data, Logit()) ERROR: Logit not defined julia fit(GeneralizedLinearModel, Y ~ X, data, link=:ProbitLink) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) julia fit(GeneralizedLinearModel, Y ~ X, data, family=binomial,link=probit) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) and a dozen other similar attempts fail. Thanks, Bradley
Re: [julia-users] Re: Has anyone successfully performed probit or logit regression in Julia?
Merged. Thanks, Bradley. — John On Aug 31, 2014, at 12:29 PM, Bradley Setzler bradley.setz...@gmail.com wrote: Thank you for suggesting this, John. https://github.com/JuliaStats/GLM.jl/pull/90 Bradley On Sunday, August 31, 2014 1:33:04 PM UTC-5, John Myles White wrote: Bradley, it’s especially easy to edit documentation because you can make a Pull Request right from the website. — John On Aug 31, 2014, at 11:30 AM, Bradley Setzler bradley...@gmail.com wrote: Thank you Adam, this works. Let me suggest that this information be included in the GLM documentation: To fit a GLM model, use the function, glm(formula, data, family, link), where, - formula uses column symbols from the DataFrame data, e.g., if names(data)=[:Y,:X], then a valid formula is Y~X; - data is a DataFrame which may contain NA values, the rows with NA values will be ignored (apparently); - family may be chosen from Binomial(), Gamma(), Normal(), or Poisson(), and the parentheses are required; and, - link may be chosen from the list in the GLM documentation, such as LogitLink(), and again the parentheses are required. For some families, a default link is available so the link argument may be left blank. Bradley On Sunday, August 31, 2014 12:56:19 PM UTC-5, Adam Kapor wrote: This works for me: ``` julia fit(GeneralizedLinearModel,Y~X,data,Binomial(),ProbitLink()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) 0.430727 1.980190.217518 0.8278 X2.37745e-17 0.91665 2.59362e-17 1. julia fit(GeneralizedLinearModel,Y~X,data,Binomial(),LogitLink()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) 0.693147 3.24037 0.21391 0.8306 X-7.44332e-17 1.5 -4.96221e-17 1. ``` On Sunday, August 31, 2014 1:27:15 PM UTC-4, Bradley Setzler wrote: Has anyone successfully performed probit or logit regression in Julia? The GLM documentation does not provide a generalizable example of how to use glm(). It gives a Poisson example without any suggestion of how to switch from Poisson to some other type. Using the Poisson example from GLM documentation works: julia X = [1;2;3.] julia Y = [1;0;1.] julia data = DataFrame(X=X,Y=Y) julia fit(GeneralizedLinearModel, Y ~ X,data, Poisson()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) -0.405465 1.87034 -0.216787 0.8284 X -3.91448e-17 0.8658 -4.52123e-17 1. But does not generalize: julia fit(GeneralizedLinearModel, Y ~ X ,data, Logit()) ERROR: Logit not defined julia fit(GeneralizedLinearModel, Y ~ X, data, link=:ProbitLink) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) julia fit(GeneralizedLinearModel, Y ~ X, data, family=binomial,link=probit) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) and a dozen other similar attempts fail. Thanks, Bradley
Re: [julia-users] Re: Has anyone successfully performed probit or logit regression in Julia?
No problem. Honestly, I'm not sure formula is a useful way to think about regression, the formula is uniquely determined from: (depVar, indepVars, data, family, link) so that the + symbols are redundant given family and link, glm(Y ~ X1 + X2 + X3 + X4 + X5 +, family, link) and it would be nice to have an explicit intercept argument like, glm(Y,X,data,family,link,intercept=true) Adding to the wish list, I would like to see something like a series option for non-parametric regression, glm(Y,X,data,family,link,seriesRank=2) where seriesRank=2 means all of the terms X1.^2, X1.*X2, X1.*X3,...,X5.^2 are included as regressors. Bradley On Sunday, August 31, 2014 2:32:30 PM UTC-5, John Myles White wrote: Merged. Thanks, Bradley. — John On Aug 31, 2014, at 12:29 PM, Bradley Setzler bradley...@gmail.com javascript: wrote: Thank you for suggesting this, John. https://github.com/JuliaStats/GLM.jl/pull/90 Bradley On Sunday, August 31, 2014 1:33:04 PM UTC-5, John Myles White wrote: Bradley, it’s especially easy to edit documentation because you can make a Pull Request right from the website. — John On Aug 31, 2014, at 11:30 AM, Bradley Setzler bradley...@gmail.com wrote: Thank you Adam, this works. Let me suggest that this information be included in the GLM documentation: To fit a GLM model, use the function, glm(formula, data, family, link), where, - formula uses column symbols from the DataFrame data, e.g., if names(data)=[:Y,:X], then a valid formula is Y~X; - data is a DataFrame which may contain NA values, the rows with NA values will be ignored (apparently); - family may be chosen from Binomial(), Gamma(), Normal(), or Poisson(), and the parentheses are required; and, - link may be chosen from the list in the GLM documentation, such as LogitLink(), and again the parentheses are required. For some families, a default link is available so the link argument may be left blank. Bradley On Sunday, August 31, 2014 12:56:19 PM UTC-5, Adam Kapor wrote: This works for me: ``` *julia **fit(GeneralizedLinearModel,Y~X,data,Binomial(),ProbitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* *Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.430727 1.980190.217518 0.8278* *X2.37745e-17 0.91665 2.59362e-17 1.* *julia **fit(GeneralizedLinearModel,Y~X,data,Binomial(),LogitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* * Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.693147 3.24037 0.21391 0.8306* *X-7.44332e-17 1.5 -4.96221e-17 1.* *```* On Sunday, August 31, 2014 1:27:15 PM UTC-4, Bradley Setzler wrote: Has anyone successfully performed probit or logit regression in Julia? The GLM documentation https://github.com/JuliaStats/GLM.jl does not provide a generalizable example of how to use glm(). It gives a Poisson example without any suggestion of how to switch from Poisson to some other type. *Using the Poisson example from GLM documentation works:* julia X = [1;2;3.] julia Y = [1;0;1.] julia data = DataFrame(X=X,Y=Y) julia fit(GeneralizedLinearModel, Y ~ X,data, Poisson()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) -0.405465 1.87034 -0.216787 0.8284 X -3.91448e-17 0.8658 -4.52123e-17 1. *But does not generalize:* julia fit(GeneralizedLinearModel, Y ~ X ,data, Logit()) ERROR: Logit not defined julia fit(GeneralizedLinearModel, Y ~ X, data, link=:ProbitLink) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) julia fit(GeneralizedLinearModel, Y ~ X, data, family=binomial,link=probit) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) and a dozen other similar attempts fail. Thanks, Bradley
Re: [julia-users] Has anyone successfully performed probit or logit regression in Julia?
Bradley, you’re forgetting about interactions terms. — John On Aug 31, 2014, at 12:53 PM, Bradley Setzler bradley.setz...@gmail.com wrote: No problem. Honestly, I'm not sure formula is a useful way to think about regression, the formula is uniquely determined from: (depVar, indepVars, data, family, link) so that the + symbols are redundant given family and link, glm(Y ~ X1 + X2 + X3 + X4 + X5 +, family, link) and it would be nice to have an explicit intercept argument like, glm(Y,X,data,family,link,intercept=true) Adding to the wish list, I would like to see something like a series option for non-parametric regression, glm(Y,X,data,family,link,seriesRank=2) where seriesRank=2 means all of the terms X1.^2, X1.*X2, X1.*X3,...,X5.^2 are included as regressors. Bradley On Sunday, August 31, 2014 2:32:30 PM UTC-5, John Myles White wrote: Merged. Thanks, Bradley. — John On Aug 31, 2014, at 12:29 PM, Bradley Setzler bradley...@gmail.com wrote: Thank you for suggesting this, John. https://github.com/JuliaStats/GLM.jl/pull/90 Bradley On Sunday, August 31, 2014 1:33:04 PM UTC-5, John Myles White wrote: Bradley, it’s especially easy to edit documentation because you can make a Pull Request right from the website. — John On Aug 31, 2014, at 11:30 AM, Bradley Setzler bradley...@gmail.com wrote: Thank you Adam, this works. Let me suggest that this information be included in the GLM documentation: To fit a GLM model, use the function, glm(formula, data, family, link), where, - formula uses column symbols from the DataFrame data, e.g., if names(data)=[:Y,:X], then a valid formula is Y~X; - data is a DataFrame which may contain NA values, the rows with NA values will be ignored (apparently); - family may be chosen from Binomial(), Gamma(), Normal(), or Poisson(), and the parentheses are required; and, - link may be chosen from the list in the GLM documentation, such as LogitLink(), and again the parentheses are required. For some families, a default link is available so the link argument may be left blank. Bradley On Sunday, August 31, 2014 12:56:19 PM UTC-5, Adam Kapor wrote: This works for me: ``` julia fit(GeneralizedLinearModel,Y~X,data,Binomial(),ProbitLink()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) 0.430727 1.980190.217518 0.8278 X2.37745e-17 0.91665 2.59362e-17 1. julia fit(GeneralizedLinearModel,Y~X,data,Binomial(),LogitLink()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) 0.693147 3.24037 0.21391 0.8306 X-7.44332e-17 1.5 -4.96221e-17 1. ``` On Sunday, August 31, 2014 1:27:15 PM UTC-4, Bradley Setzler wrote: Has anyone successfully performed probit or logit regression in Julia? The GLM documentation does not provide a generalizable example of how to use glm(). It gives a Poisson example without any suggestion of how to switch from Poisson to some other type. Using the Poisson example from GLM documentation works: julia X = [1;2;3.] julia Y = [1;0;1.] julia data = DataFrame(X=X,Y=Y) julia fit(GeneralizedLinearModel, Y ~ X,data, Poisson()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) -0.405465 1.87034 -0.216787 0.8284 X -3.91448e-17 0.8658 -4.52123e-17 1. But does not generalize: julia fit(GeneralizedLinearModel, Y ~ X ,data, Logit()) ERROR: Logit not defined julia fit(GeneralizedLinearModel, Y ~ X, data, link=:ProbitLink) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) julia fit(GeneralizedLinearModel, Y ~ X, data, family=binomial,link=probit) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) and a dozen other similar attempts fail. Thanks, Bradley
Re: [julia-users] Issue Replacing NaN with 0
I think there’s a broad issue that need resolution: how do you know when a function’s output takes control of the memory used by its arguments? — John On Aug 31, 2014, at 11:45 AM, Ethan Anderes ethanande...@gmail.com wrote: Yeah, I can see your point John. It's probably not reasonable to make a new AliasedArray type. For me I think the education would address the difference between vec, for example, when used inside another function, eg x = sin(vec(a)), or the memory overlap case, eg x = vec(a). This stung me at one point. When ArrayViews lands as slicing in Base I should take a shot at a PR for the docs. Cheers
Re: [julia-users] Has anyone successfully performed probit or logit regression in Julia?
Sorry, I meant for those to be in the ... term. Let me write them explicitly for the case of 3 independent variables, X1 X2 X3, seriesRank=2 would be, (intercept) X1.^2 X2.^2 X3.^2 X1.*X2 X1.*X3 X2.*X3 X1.*X2.*X3 Bradley On Sunday, August 31, 2014 2:55:22 PM UTC-5, John Myles White wrote: Bradley, you’re forgetting about interactions terms. — John On Aug 31, 2014, at 12:53 PM, Bradley Setzler bradley...@gmail.com javascript: wrote: No problem. Honestly, I'm not sure formula is a useful way to think about regression, the formula is uniquely determined from: (depVar, indepVars, data, family, link) so that the + symbols are redundant given family and link, glm(Y ~ X1 + X2 + X3 + X4 + X5 +, family, link) and it would be nice to have an explicit intercept argument like, glm(Y,X,data,family,link,intercept=true) Adding to the wish list, I would like to see something like a series option for non-parametric regression, glm(Y,X,data,family,link,seriesRank=2) where seriesRank=2 means all of the terms X1.^2, X1.*X2, X1.*X3,...,X5.^2 are included as regressors. Bradley On Sunday, August 31, 2014 2:32:30 PM UTC-5, John Myles White wrote: Merged. Thanks, Bradley. — John On Aug 31, 2014, at 12:29 PM, Bradley Setzler bradley...@gmail.com wrote: Thank you for suggesting this, John. https://github.com/JuliaStats/GLM.jl/pull/90 Bradley On Sunday, August 31, 2014 1:33:04 PM UTC-5, John Myles White wrote: Bradley, it’s especially easy to edit documentation because you can make a Pull Request right from the website. — John On Aug 31, 2014, at 11:30 AM, Bradley Setzler bradley...@gmail.com wrote: Thank you Adam, this works. Let me suggest that this information be included in the GLM documentation: To fit a GLM model, use the function, glm(formula, data, family, link), where, - formula uses column symbols from the DataFrame data, e.g., if names(data)=[:Y,:X], then a valid formula is Y~X; - data is a DataFrame which may contain NA values, the rows with NA values will be ignored (apparently); - family may be chosen from Binomial(), Gamma(), Normal(), or Poisson(), and the parentheses are required; and, - link may be chosen from the list in the GLM documentation, such as LogitLink(), and again the parentheses are required. For some families, a default link is available so the link argument may be left blank. Bradley On Sunday, August 31, 2014 12:56:19 PM UTC-5, Adam Kapor wrote: This works for me: ``` *julia **fit(GeneralizedLinearModel,Y~X,data,Binomial(),ProbitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* *Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.430727 1.980190.217518 0.8278* *X2.37745e-17 0.91665 2.59362e-17 1.* *julia **fit(GeneralizedLinearModel,Y~X,data,Binomial(),LogitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* * Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.693147 3.24037 0.21391 0.8306* *X-7.44332e-17 1.5 -4.96221e-17 1.* *```* On Sunday, August 31, 2014 1:27:15 PM UTC-4, Bradley Setzler wrote: Has anyone successfully performed probit or logit regression in Julia? The GLM documentation https://github.com/JuliaStats/GLM.jl does not provide a generalizable example of how to use glm(). It gives a Poisson example without any suggestion of how to switch from Poisson to some other type. *Using the Poisson example from GLM documentation works:* julia X = [1;2;3.] julia Y = [1;0;1.] julia data = DataFrame(X=X,Y=Y) julia fit(GeneralizedLinearModel, Y ~ X,data, Poisson()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) -0.405465 1.87034 -0.216787 0.8284 X -3.91448e-17 0.8658 -4.52123e-17 1. *But does not generalize:* julia fit(GeneralizedLinearModel, Y ~ X ,data, Logit()) ERROR: Logit not defined julia fit(GeneralizedLinearModel, Y ~ X, data, link=:ProbitLink) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) julia fit(GeneralizedLinearModel, Y ~ X, data, family=binomial,link=probit) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) and a dozen other similar attempts fail. Thanks, Bradley
Re: [julia-users] Has anyone successfully performed probit or logit regression in Julia?
And X1 X2 X3 Did I get all of them? On Sunday, August 31, 2014 3:02:06 PM UTC-5, Bradley Setzler wrote: Sorry, I meant for those to be in the ... term. Let me write them explicitly for the case of 3 independent variables, X1 X2 X3, seriesRank=2 would be, (intercept) X1.^2 X2.^2 X3.^2 X1.*X2 X1.*X3 X2.*X3 X1.*X2.*X3 Bradley On Sunday, August 31, 2014 2:55:22 PM UTC-5, John Myles White wrote: Bradley, you’re forgetting about interactions terms. — John On Aug 31, 2014, at 12:53 PM, Bradley Setzler bradley...@gmail.com wrote: No problem. Honestly, I'm not sure formula is a useful way to think about regression, the formula is uniquely determined from: (depVar, indepVars, data, family, link) so that the + symbols are redundant given family and link, glm(Y ~ X1 + X2 + X3 + X4 + X5 +, family, link) and it would be nice to have an explicit intercept argument like, glm(Y,X,data,family,link,intercept=true) Adding to the wish list, I would like to see something like a series option for non-parametric regression, glm(Y,X,data,family,link,seriesRank=2) where seriesRank=2 means all of the terms X1.^2, X1.*X2, X1.*X3,...,X5.^2 are included as regressors. Bradley On Sunday, August 31, 2014 2:32:30 PM UTC-5, John Myles White wrote: Merged. Thanks, Bradley. — John On Aug 31, 2014, at 12:29 PM, Bradley Setzler bradley...@gmail.com wrote: Thank you for suggesting this, John. https://github.com/JuliaStats/GLM.jl/pull/90 Bradley On Sunday, August 31, 2014 1:33:04 PM UTC-5, John Myles White wrote: Bradley, it’s especially easy to edit documentation because you can make a Pull Request right from the website. — John On Aug 31, 2014, at 11:30 AM, Bradley Setzler bradley...@gmail.com wrote: Thank you Adam, this works. Let me suggest that this information be included in the GLM documentation: To fit a GLM model, use the function, glm(formula, data, family, link), where, - formula uses column symbols from the DataFrame data, e.g., if names(data)=[:Y,:X], then a valid formula is Y~X; - data is a DataFrame which may contain NA values, the rows with NA values will be ignored (apparently); - family may be chosen from Binomial(), Gamma(), Normal(), or Poisson(), and the parentheses are required; and, - link may be chosen from the list in the GLM documentation, such as LogitLink(), and again the parentheses are required. For some families, a default link is available so the link argument may be left blank. Bradley On Sunday, August 31, 2014 12:56:19 PM UTC-5, Adam Kapor wrote: This works for me: ``` *julia * *fit(GeneralizedLinearModel,Y~X,data,Binomial(),ProbitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* *Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.430727 1.980190.217518 0.8278* *X2.37745e-17 0.91665 2.59362e-17 1.* *julia **fit(GeneralizedLinearModel,Y~X,data,Binomial(),LogitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* * Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.693147 3.24037 0.21391 0.8306* *X-7.44332e-17 1.5 -4.96221e-17 1.* *```* On Sunday, August 31, 2014 1:27:15 PM UTC-4, Bradley Setzler wrote: Has anyone successfully performed probit or logit regression in Julia? The GLM documentation https://github.com/JuliaStats/GLM.jl does not provide a generalizable example of how to use glm(). It gives a Poisson example without any suggestion of how to switch from Poisson to some other type. *Using the Poisson example from GLM documentation works:* julia X = [1;2;3.] julia Y = [1;0;1.] julia data = DataFrame(X=X,Y=Y) julia fit(GeneralizedLinearModel, Y ~ X,data, Poisson()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) -0.405465 1.87034 -0.216787 0.8284 X -3.91448e-17 0.8658 -4.52123e-17 1. *But does not generalize:* julia fit(GeneralizedLinearModel, Y ~ X ,data, Logit()) ERROR: Logit not defined julia fit(GeneralizedLinearModel, Y ~ X, data, link=:ProbitLink) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) julia fit(GeneralizedLinearModel, Y ~ X, data, family=binomial,link=probit) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) and a dozen other similar attempts fail. Thanks, Bradley
Re: [julia-users] Has anyone successfully performed probit or logit regression in Julia?
I see. This is a pretty radical change to how GLM’s would be specified. I think the only realistic way you could make any progress on such a radical proposal is to undertake this change as a project on your own and then give people a demo of a system you’ve built that’s noticeably better than what they’re used to having in R. — John On Aug 31, 2014, at 1:02 PM, Bradley Setzler bradley.setz...@gmail.com wrote: Sorry, I meant for those to be in the ... term. Let me write them explicitly for the case of 3 independent variables, X1 X2 X3, seriesRank=2 would be, (intercept) X1.^2 X2.^2 X3.^2 X1.*X2 X1.*X3 X2.*X3 X1.*X2.*X3 Bradley On Sunday, August 31, 2014 2:55:22 PM UTC-5, John Myles White wrote: Bradley, you’re forgetting about interactions terms. — John On Aug 31, 2014, at 12:53 PM, Bradley Setzler bradley...@gmail.com wrote: No problem. Honestly, I'm not sure formula is a useful way to think about regression, the formula is uniquely determined from: (depVar, indepVars, data, family, link) so that the + symbols are redundant given family and link, glm(Y ~ X1 + X2 + X3 + X4 + X5 +, family, link) and it would be nice to have an explicit intercept argument like, glm(Y,X,data,family,link,intercept=true) Adding to the wish list, I would like to see something like a series option for non-parametric regression, glm(Y,X,data,family,link,seriesRank=2) where seriesRank=2 means all of the terms X1.^2, X1.*X2, X1.*X3,...,X5.^2 are included as regressors. Bradley On Sunday, August 31, 2014 2:32:30 PM UTC-5, John Myles White wrote: Merged. Thanks, Bradley. — John On Aug 31, 2014, at 12:29 PM, Bradley Setzler bradley...@gmail.com wrote: Thank you for suggesting this, John. https://github.com/JuliaStats/GLM.jl/pull/90 Bradley On Sunday, August 31, 2014 1:33:04 PM UTC-5, John Myles White wrote: Bradley, it’s especially easy to edit documentation because you can make a Pull Request right from the website. — John On Aug 31, 2014, at 11:30 AM, Bradley Setzler bradley...@gmail.com wrote: Thank you Adam, this works. Let me suggest that this information be included in the GLM documentation: To fit a GLM model, use the function, glm(formula, data, family, link), where, - formula uses column symbols from the DataFrame data, e.g., if names(data)=[:Y,:X], then a valid formula is Y~X; - data is a DataFrame which may contain NA values, the rows with NA values will be ignored (apparently); - family may be chosen from Binomial(), Gamma(), Normal(), or Poisson(), and the parentheses are required; and, - link may be chosen from the list in the GLM documentation, such as LogitLink(), and again the parentheses are required. For some families, a default link is available so the link argument may be left blank. Bradley On Sunday, August 31, 2014 12:56:19 PM UTC-5, Adam Kapor wrote: This works for me: ``` julia fit(GeneralizedLinearModel,Y~X,data,Binomial(),ProbitLink()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) 0.430727 1.980190.217518 0.8278 X2.37745e-17 0.91665 2.59362e-17 1. julia fit(GeneralizedLinearModel,Y~X,data,Binomial(),LogitLink()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) 0.693147 3.24037 0.21391 0.8306 X-7.44332e-17 1.5 -4.96221e-17 1. ``` On Sunday, August 31, 2014 1:27:15 PM UTC-4, Bradley Setzler wrote: Has anyone successfully performed probit or logit regression in Julia? The GLM documentation does not provide a generalizable example of how to use glm(). It gives a Poisson example without any suggestion of how to switch from Poisson to some other type. Using the Poisson example from GLM documentation works: julia X = [1;2;3.] julia Y = [1;0;1.] julia data = DataFrame(X=X,Y=Y) julia fit(GeneralizedLinearModel, Y ~ X,data, Poisson()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) -0.405465 1.87034 -0.216787 0.8284 X -3.91448e-17 0.8658 -4.52123e-17 1. But does not generalize: julia fit(GeneralizedLinearModel, Y ~ X ,data, Logit()) ERROR: Logit not defined julia fit(GeneralizedLinearModel, Y ~ X, data, link=:ProbitLink) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) julia fit(GeneralizedLinearModel, Y ~ X, data, family=binomial,link=probit) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel}, ::Array{Float64,2}, ::Array{Float64,1}) and a dozen other similar attempts fail. Thanks, Bradley
Re: [julia-users] Has anyone successfully performed probit or logit regression in Julia?
Yeah, or it might be easier to do it separately, like a function seriesData = createSeries(data, rank=2) which returns a DataFrame that contains all of those series terms. Then seriesData would simply be used as the data argument in glm(). Bradley On Sunday, August 31, 2014 3:05:12 PM UTC-5, John Myles White wrote: I see. This is a pretty radical change to how GLM’s would be specified. I think the only realistic way you could make any progress on such a radical proposal is to undertake this change as a project on your own and then give people a demo of a system you’ve built that’s noticeably better than what they’re used to having in R. — John On Aug 31, 2014, at 1:02 PM, Bradley Setzler bradley...@gmail.com javascript: wrote: Sorry, I meant for those to be in the ... term. Let me write them explicitly for the case of 3 independent variables, X1 X2 X3, seriesRank=2 would be, (intercept) X1.^2 X2.^2 X3.^2 X1.*X2 X1.*X3 X2.*X3 X1.*X2.*X3 Bradley On Sunday, August 31, 2014 2:55:22 PM UTC-5, John Myles White wrote: Bradley, you’re forgetting about interactions terms. — John On Aug 31, 2014, at 12:53 PM, Bradley Setzler bradley...@gmail.com wrote: No problem. Honestly, I'm not sure formula is a useful way to think about regression, the formula is uniquely determined from: (depVar, indepVars, data, family, link) so that the + symbols are redundant given family and link, glm(Y ~ X1 + X2 + X3 + X4 + X5 +, family, link) and it would be nice to have an explicit intercept argument like, glm(Y,X,data,family,link,intercept=true) Adding to the wish list, I would like to see something like a series option for non-parametric regression, glm(Y,X,data,family,link,seriesRank=2) where seriesRank=2 means all of the terms X1.^2, X1.*X2, X1.*X3,...,X5.^2 are included as regressors. Bradley On Sunday, August 31, 2014 2:32:30 PM UTC-5, John Myles White wrote: Merged. Thanks, Bradley. — John On Aug 31, 2014, at 12:29 PM, Bradley Setzler bradley...@gmail.com wrote: Thank you for suggesting this, John. https://github.com/JuliaStats/GLM.jl/pull/90 Bradley On Sunday, August 31, 2014 1:33:04 PM UTC-5, John Myles White wrote: Bradley, it’s especially easy to edit documentation because you can make a Pull Request right from the website. — John On Aug 31, 2014, at 11:30 AM, Bradley Setzler bradley...@gmail.com wrote: Thank you Adam, this works. Let me suggest that this information be included in the GLM documentation: To fit a GLM model, use the function, glm(formula, data, family, link), where, - formula uses column symbols from the DataFrame data, e.g., if names(data)=[:Y,:X], then a valid formula is Y~X; - data is a DataFrame which may contain NA values, the rows with NA values will be ignored (apparently); - family may be chosen from Binomial(), Gamma(), Normal(), or Poisson(), and the parentheses are required; and, - link may be chosen from the list in the GLM documentation, such as LogitLink(), and again the parentheses are required. For some families, a default link is available so the link argument may be left blank. Bradley On Sunday, August 31, 2014 12:56:19 PM UTC-5, Adam Kapor wrote: This works for me: ``` *julia * *fit(GeneralizedLinearModel,Y~X,data,Binomial(),ProbitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* *Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.430727 1.980190.217518 0.8278* *X2.37745e-17 0.91665 2.59362e-17 1.* *julia **fit(GeneralizedLinearModel,Y~X,data,Binomial(),LogitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* * Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.693147 3.24037 0.21391 0.8306* *X-7.44332e-17 1.5 -4.96221e-17 1.* *```* On Sunday, August 31, 2014 1:27:15 PM UTC-4, Bradley Setzler wrote: Has anyone successfully performed probit or logit regression in Julia? The GLM documentation https://github.com/JuliaStats/GLM.jl does not provide a generalizable example of how to use glm(). It gives a Poisson example without any suggestion of how to switch from Poisson to some other type. *Using the Poisson example from GLM documentation works:* julia X = [1;2;3.] julia Y = [1;0;1.] julia data = DataFrame(X=X,Y=Y) julia fit(GeneralizedLinearModel, Y ~ X,data, Poisson()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) -0.405465 1.87034 -0.216787 0.8284 X -3.91448e-17 0.8658 -4.52123e-17 1. *But does not generalize:* julia fit(GeneralizedLinearModel, Y ~ X ,data, Logit()) ERROR: Logit not defined julia fit(GeneralizedLinearModel, Y ~ X, data, link=:ProbitLink) ERROR: `fit` has no method matching fit(::Type{GeneralizedLinearModel},
Re: [julia-users] Has anyone successfully performed probit or logit regression in Julia?
Yeah, there are a lot of possible interfaces for this. Early on in JuliaStats there was a little bit of work to do polynomial regression, which fizzled out because of its considerable complexity. — John On Aug 31, 2014, at 1:11 PM, Bradley Setzler bradley.setz...@gmail.com wrote: Yeah, or it might be easier to do it separately, like a function seriesData = createSeries(data, rank=2) which returns a DataFrame that contains all of those series terms. Then seriesData would simply be used as the data argument in glm(). Bradley On Sunday, August 31, 2014 3:05:12 PM UTC-5, John Myles White wrote: I see. This is a pretty radical change to how GLM’s would be specified. I think the only realistic way you could make any progress on such a radical proposal is to undertake this change as a project on your own and then give people a demo of a system you’ve built that’s noticeably better than what they’re used to having in R. — John On Aug 31, 2014, at 1:02 PM, Bradley Setzler bradley...@gmail.com wrote: Sorry, I meant for those to be in the ... term. Let me write them explicitly for the case of 3 independent variables, X1 X2 X3, seriesRank=2 would be, (intercept) X1.^2 X2.^2 X3.^2 X1.*X2 X1.*X3 X2.*X3 X1.*X2.*X3 Bradley On Sunday, August 31, 2014 2:55:22 PM UTC-5, John Myles White wrote: Bradley, you’re forgetting about interactions terms. — John On Aug 31, 2014, at 12:53 PM, Bradley Setzler bradley...@gmail.com wrote: No problem. Honestly, I'm not sure formula is a useful way to think about regression, the formula is uniquely determined from: (depVar, indepVars, data, family, link) so that the + symbols are redundant given family and link, glm(Y ~ X1 + X2 + X3 + X4 + X5 +, family, link) and it would be nice to have an explicit intercept argument like, glm(Y,X,data,family,link,intercept=true) Adding to the wish list, I would like to see something like a series option for non-parametric regression, glm(Y,X,data,family,link,seriesRank=2) where seriesRank=2 means all of the terms X1.^2, X1.*X2, X1.*X3,...,X5.^2 are included as regressors. Bradley On Sunday, August 31, 2014 2:32:30 PM UTC-5, John Myles White wrote: Merged. Thanks, Bradley. — John On Aug 31, 2014, at 12:29 PM, Bradley Setzler bradley...@gmail.com wrote: Thank you for suggesting this, John. https://github.com/JuliaStats/GLM.jl/pull/90 Bradley On Sunday, August 31, 2014 1:33:04 PM UTC-5, John Myles White wrote: Bradley, it’s especially easy to edit documentation because you can make a Pull Request right from the website. — John On Aug 31, 2014, at 11:30 AM, Bradley Setzler bradley...@gmail.com wrote: Thank you Adam, this works. Let me suggest that this information be included in the GLM documentation: To fit a GLM model, use the function, glm(formula, data, family, link), where, - formula uses column symbols from the DataFrame data, e.g., if names(data)=[:Y,:X], then a valid formula is Y~X; - data is a DataFrame which may contain NA values, the rows with NA values will be ignored (apparently); - family may be chosen from Binomial(), Gamma(), Normal(), or Poisson(), and the parentheses are required; and, - link may be chosen from the list in the GLM documentation, such as LogitLink(), and again the parentheses are required. For some families, a default link is available so the link argument may be left blank. Bradley On Sunday, August 31, 2014 12:56:19 PM UTC-5, Adam Kapor wrote: This works for me: ``` julia fit(GeneralizedLinearModel,Y~X,data,Binomial(),ProbitLink()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) 0.430727 1.980190.217518 0.8278 X2.37745e-17 0.91665 2.59362e-17 1. julia fit(GeneralizedLinearModel,Y~X,data,Binomial(),LogitLink()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) 0.693147 3.24037 0.21391 0.8306 X-7.44332e-17 1.5 -4.96221e-17 1. ``` On Sunday, August 31, 2014 1:27:15 PM UTC-4, Bradley Setzler wrote: Has anyone successfully performed probit or logit regression in Julia? The GLM documentation does not provide a generalizable example of how to use glm(). It gives a Poisson example without any suggestion of how to switch from Poisson to some other type. Using the Poisson example from GLM documentation works: julia X = [1;2;3.] julia Y = [1;0;1.] julia data = DataFrame(X=X,Y=Y) julia fit(GeneralizedLinearModel, Y ~ X,data, Poisson()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) -0.405465 1.87034 -0.216787 0.8284 X -3.91448e-17 0.8658 -4.52123e-17 1. But does not
Re: [julia-users] List of useful macros for beginners?
Hi Leah, Thanks! I'm trying to switch from Python to Julia and would like to learn some simple common tricks but not planning to write my own macros at this moment. Xiaowei 在 2014年9月1日星期一UTC+8上午12时06分56秒,Leah Hanson写道: @show and @which are two other common ones. There are examples of how to use them in this blog post: http://www.juliabloggers.com/julia-helps/ (- I wrote this blog post.) Are you looking for examples of macros you would want to use or examples of macros to help you write your own macros? -- Leah On Sun, Aug 31, 2014 at 8:47 AM, Xiaowei Zhang xiaowei...@gmail.com javascript: wrote: For example, the Julia manual illustrates the usage of @inbound and @simd as performance tips. Can anyone provide a short list of macros with examples besides these two?
Re: [julia-users] Has anyone successfully performed probit or logit regression in Julia?
Does anyone know how to get predicted Y values after fitting the glm regression of Y on X? The documentation mentions LinPred, which may be it, but I'm not having luck getting it to work. I would have guessed it was something like this: julia X = [1;2;3.] julia Y = [1;0;1.] julia data = DataFrame(X=X,Y=Y) julia OLS = glm(Y~X,data,Normal(),IdentityLink()) DataFrameRegressionModel{GeneralizedLinearModel,Float64}: Coefficients: Estimate Std.Error z value Pr(|z|) (Intercept) 0.67 1.24722 0.534522 0.5930 X -4.16334e-16 0.57735 -7.2e-16 1. julia LinPred(OLS) ERROR: type cannot be constructed julia LinPred(OLS,data,X) ERROR: type cannot be constructed julia OLS(X) ERROR: type: apply: expected Function, got DataFrameRegressionModel{GeneralizedLinearModel,Float64} Thanks, Bradley On Sunday, August 31, 2014 3:12:55 PM UTC-5, John Myles White wrote: Yeah, there are a lot of possible interfaces for this. Early on in JuliaStats there was a little bit of work to do polynomial regression, which fizzled out because of its considerable complexity. — John On Aug 31, 2014, at 1:11 PM, Bradley Setzler bradley...@gmail.com javascript: wrote: Yeah, or it might be easier to do it separately, like a function seriesData = createSeries(data, rank=2) which returns a DataFrame that contains all of those series terms. Then seriesData would simply be used as the data argument in glm(). Bradley On Sunday, August 31, 2014 3:05:12 PM UTC-5, John Myles White wrote: I see. This is a pretty radical change to how GLM’s would be specified. I think the only realistic way you could make any progress on such a radical proposal is to undertake this change as a project on your own and then give people a demo of a system you’ve built that’s noticeably better than what they’re used to having in R. — John On Aug 31, 2014, at 1:02 PM, Bradley Setzler bradley...@gmail.com wrote: Sorry, I meant for those to be in the ... term. Let me write them explicitly for the case of 3 independent variables, X1 X2 X3, seriesRank=2 would be, (intercept) X1.^2 X2.^2 X3.^2 X1.*X2 X1.*X3 X2.*X3 X1.*X2.*X3 Bradley On Sunday, August 31, 2014 2:55:22 PM UTC-5, John Myles White wrote: Bradley, you’re forgetting about interactions terms. — John On Aug 31, 2014, at 12:53 PM, Bradley Setzler bradley...@gmail.com wrote: No problem. Honestly, I'm not sure formula is a useful way to think about regression, the formula is uniquely determined from: (depVar, indepVars, data, family, link) so that the + symbols are redundant given family and link, glm(Y ~ X1 + X2 + X3 + X4 + X5 +, family, link) and it would be nice to have an explicit intercept argument like, glm(Y,X,data,family,link,intercept=true) Adding to the wish list, I would like to see something like a series option for non-parametric regression, glm(Y,X,data,family,link,seriesRank=2) where seriesRank=2 means all of the terms X1.^2, X1.*X2, X1.*X3,...,X5.^2 are included as regressors. Bradley On Sunday, August 31, 2014 2:32:30 PM UTC-5, John Myles White wrote: Merged. Thanks, Bradley. — John On Aug 31, 2014, at 12:29 PM, Bradley Setzler bradley...@gmail.com wrote: Thank you for suggesting this, John. https://github.com/JuliaStats/GLM.jl/pull/90 Bradley On Sunday, August 31, 2014 1:33:04 PM UTC-5, John Myles White wrote: Bradley, it’s especially easy to edit documentation because you can make a Pull Request right from the website. — John On Aug 31, 2014, at 11:30 AM, Bradley Setzler bradley...@gmail.com wrote: Thank you Adam, this works. Let me suggest that this information be included in the GLM documentation: To fit a GLM model, use the function, glm(formula, data, family, link), where, - formula uses column symbols from the DataFrame data, e.g., if names(data)=[:Y,:X], then a valid formula is Y~X; - data is a DataFrame which may contain NA values, the rows with NA values will be ignored (apparently); - family may be chosen from Binomial(), Gamma(), Normal(), or Poisson(), and the parentheses are required; and, - link may be chosen from the list in the GLM documentation, such as LogitLink(), and again the parentheses are required. For some families, a default link is available so the link argument may be left blank. Bradley On Sunday, August 31, 2014 12:56:19 PM UTC-5, Adam Kapor wrote: This works for me: ``` *julia * *fit(GeneralizedLinearModel,Y~X,data,Binomial(),ProbitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* *Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.430727 1.980190.217518 0.8278* *X2.37745e-17 0.91665 2.59362e-17 1.* *julia * *fit(GeneralizedLinearModel,Y~X,data,Binomial(),LogitLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* * Estimate Std.Error
[julia-users] Help with Clang.jl for a C beginner
Hi all - I've been trying to learn more about C and how Julia interacts and decided to play around with Clang.jl. I decided I was going to wrap liboauth from here: http://liboauth.sourceforge.net/oauth_8h_source.html I downloaded the C source, which resided in my OSX Downloads directory. Using the following Julia code generated a bunch of output: [1]: using Clang.wrap_c In [2]: context = wrap_c.init(; output_file=liboauth.jl, header_library=x-liboauth, common_file=liboauth.jl, clang_diagnostics=true) context.options.wrap_structs = true wrap_c.wrap_c_headers(context, [/Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h]) WARNING: wrap_c_headers: deprecated /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:112:46: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:138:54: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:138:86: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:315:67: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:315:81: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:320:66: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:320:80: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:519:28: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:532:30: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:670:61: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:688:57: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:715:43: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:717:70: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:717:77: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:717:77: error: redefinition of parameter 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:717:70: note: previous declaration is here /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:741:24: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:771:43: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:773:70: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:773:77: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:773:77: error: redefinition of parameter 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:773:70: note: previous declaration is here WRAPPING HEADER: /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h WARNING: Not wrapping MacroInstantiation OA_GCC_VERSION_AT_LEAST WARNING: Not wrapping MacroInstantiation attribute_deprecated WARNING: Not wrapping MacroInstantiation attribute_deprecated WARNING: Not wrapping MacroInstantiation attribute_deprecated WARNING: Not wrapping MacroInstantiation attribute_deprecated WARNING: Not wrapping MacroInstantiation attribute_deprecated WARNING: Not wrapping MacroInstantiation attribute_deprecated WARNING: Not wrapping MacroInstantiation attribute_deprecated WARNING: Not wrapping MacroInstantiation attribute_deprecated WARNING: Not wrapping MacroInstantiation attribute_deprecated WARNING: Not wrapping MacroInstantiation attribute_deprecated WARNING: Not wrapping MacroInstantiation attribute_deprecated WARNING: Not wrapping MacroInstantiation attribute_deprecated WARNING: Not wrapping MacroInstantiation attribute_deprecated writing liboauth.jl Out[2]: 1-element Array{Any,1}: nothing Output: const LIBOAUTH_VERSION = 1.0.3 const LIBOAUTH_VERSION_MAJOR = 1 const LIBOAUTH_VERSION_MINOR = 0 const LIBOAUTH_VERSION_MICRO = 3 const LIBOAUTH_CUR = 8 const LIBOAUTH_REV = 7 const LIBOAUTH_AGE = 8 # Skipping MacroDefinition: OA_GCC_VERSION_AT_LEAST ( x , y ) ( __GNUC__ x || __GNUC__ == x __GNUC_MINOR__ = y ) # Skipping MacroDefinition: attribute_deprecated __attribute__ ( ( deprecated ) ) # begin enum ANONYMOUS_1 typealias ANONYMOUS_1 Uint32 const OA_HMAC = (uint32)(0) const OA_RSA = (uint32)(1) const OA_PLAINTEXT = (uint32)(2) # end enum ANONYMOUS_1 # begin enum OAuthMethod typealias OAuthMethod Uint32 const OA_HMAC = (uint32)(0) const OA_RSA = (uint32)(1) const OA_PLAINTEXT = (uint32)(2) # end enum OAuthMethod function oauth_sign_hmac_sha1(m::Ptr{Uint8},k::Ptr{Uint8}) ccall((:oauth_sign_hmac_sha1,liboauth),Ptr{Uint8},(Ptr{Uint8},Ptr{Uint8}),m,k) end function
Re: [julia-users] Help with Clang.jl for a C beginner
Hello Randy, the following comes from my experience with ccall and Julia documentation. Please anyone correct me if I explained any of the internals wrong! The API seems to be really simple so pretty much everything can be done with standard Julia types. Clang.jl seems to have generated correct code for it. Regarding 2, liboauth.dylib (or .dll, or .so on Linux) has to be loaded and passed to ccall. You can load it by hand using dlopen, like this: liboauth = dlopen(/path/of/liboauth.dylib) This will raise an error if the path is not valid. If the library is in your environment's standard path, you can pass its name to ccall as a string instead of creating a pointer with dlopen. Most of the Ptr{Uint8} you got in the code generated by Clang.jl are actually mapping char *, which are C strings (ASCII, not Unicode). For example, let's say you wanted to call puts from libc, which is a function that gets a string as its argument, prints it to the screen followed by a newline, and returns the number of printed characters. You could do it like this: ccall((:puts, libc), Cint, (Ptr{Uint8},), Hello, Randy) So, you basically can pass your string as the function argument and it should work. You don't need to pass a pointer, but it's good to know that your Julia ASCIIString was converted to Ptr{Uint8} internally. With this you should be able to call functions, but you still need to be able to recover their output. The second argument to ccall is the C function return type, but note that often C functions do not return their output in the return type, but in a variable which was passed by reference as one of its arguments. I don't know enough of liboauth to know what's the case, so you will need to check the documentation. See the sections http://docs.julialang.org/en/release-0.3/manual/calling-c-and-fortran-code/#accessing-data-through-a-pointer and http://docs.julialang.org/en/release-0.3/manual/calling-c-and-fortran-code/#passing-pointers-for-modifying-inputs for more details on that. -- João Felipe Santos On Sun, Aug 31, 2014 at 8:17 PM, Randy Zwitch randy.zwi...@fuqua.duke.edu wrote: Hi all - I've been trying to learn more about C and how Julia interacts and decided to play around with Clang.jl. I decided I was going to wrap liboauth from here: http://liboauth.sourceforge.net/oauth_8h_source.html I downloaded the C source, which resided in my OSX Downloads directory. Using the following Julia code generated a bunch of output: [1]: using Clang.wrap_c In [2]: context = wrap_c.init(; output_file=liboauth.jl, header_library=x-liboauth, common_file=liboauth.jl, clang_diagnostics=true) context.options.wrap_structs = true wrap_c.wrap_c_headers(context, [/Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h]) WARNING: wrap_c_headers: deprecated /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:112:46: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:138:54: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:138:86: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:315:67: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:315:81: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:320:66: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:320:80: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:519:28: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:532:30: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:670:61: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:688:57: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:715:43: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:717:70: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:717:77: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:717:77: error: redefinition of parameter 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:717:70: note: previous declaration is here /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:741:24: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:771:43: error: unknown type name 'size_t' /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:773:70: warning: type specifier missing, defaults to 'int' [-Wimplicit-int] /Users/randyzwitch/Downloads/liboauth-1.0.3/src/oauth.h:773:77: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
Re: [julia-users] Has anyone successfully performed probit or logit regression in Julia?
Are you looking for the fitted values? Is predict(OLS) what you are looking for? *julia **X = [1;2;3.]* *3-element Array{Float64,1}:* * 1.0* * 2.0* * 3.0* *julia **Y = [1;0;1.]* *3-element Array{Float64,1}:* * 1.0* * 0.0* * 1.0* *julia **data = DataFrame(X=X,Y=Y)* *3x2 DataFrame* *|---|-|-|* *| Row # | X | Y |* *| 1 | 1.0 | 1.0 |* *| 2 | 2.0 | 0.0 |* *| 3 | 3.0 | 1.0 |* *julia **OLS = glm(Y~X,data,Normal(),IdentityLink())* *DataFrameRegressionModel{GeneralizedLinearModel,Float64}:* *Coefficients:* * Estimate Std.Error z value Pr(|z|)* *(Intercept) 0.67 1.24722 0.534522 0.5930* *X-4.16334e-16 0.57735 -7.2e-16 1.* *julia **predict(OLS)* *3-element Array{Float64,1}:* * 0.67* * 0.67* * 0.67*
Re: [julia-users] trouble after updating Julia
I'm also having problems, and I wonder if I've run into the same issue. When I updated Julia today on my Mac (10.9.2), I got the following error: /bin/sh: line 1: 23089 Segmentation fault: 11 /Users/danluu/dev/julia/usr/bin/julia --build /Users/danluu/dev/julia/usr/lib/julia/sys -J/Users/danluu/dev/julia/usr/lib/julia/$([ -e /Users/danluu/dev/julia/usr/lib/julia/sys.ji ] echo sys.ji || echo sys0.ji) -f sysimg.jl * This error is usually fixed by running 'make clean'. If the error persists, try 'make cleanall'. * make[1]: * [/Users/danluu/dev/julia/usr/lib/julia/sys.o] Error 1 make: * [release] Error 2 I've tried doing make cleanall, and even wiping out my repository and re-cloning in case it's a problem with deps, and I still get the same error. On Linux (64-bit, 3.2.0-65-generic), the build doesn't error out, but Julia segfaults on startup. The gdb backtrace for that is: Program received signal SIGSEGV, Segmentation fault. 0x76e2328c in jl_deserialize_gv (v=0x7bb138, s=0x7fffdcc0) at dump.c:145 145 *sysimg_gvars[gvname_index] = v; (gdb) bt #0 0x76e2328c in jl_deserialize_gv (v=0x7bb138, s=0x7fffdcc0) at dump.c:145 #1 jl_deserialize_value_internal (s=0x7fffdcc0) at dump.c:854 #2 0x76e233e5 in jl_deserialize_value (s=0x7fffdcc0) at dump.c:950 #3 jl_deserialize_value_internal (s=0x7fffdcc0) at dump.c:937 #4 0x76e2350d in jl_deserialize_value (s=0x7fffdcc0) at dump.c:950 #5 jl_deserialize_datatype (pos=403560, s=0x7fffdcc0) at dump.c:646 #6 jl_deserialize_value_internal (s=0x7fffdcc0) at dump.c:886 #7 0x76e22818 in jl_deserialize_value (s=0x7fffdcc0) at dump.c:950 #8 jl_deserialize_value_internal (s=0x7fffdcc0) at dump.c:715 ... #134 jl_deserialize_value_internal (s=0x7fffdcc0) at dump.c:715 #135 0x76e233e5 in jl_deserialize_value (s=0x7fffdcc0) at dump.c:950 #136 jl_deserialize_value_internal (s=0x7fffdcc0) at dump.c:937 #137 0x76e233e5 in jl_deserialize_value (s=0x7fffdcc0) at dump.c:950 #138 jl_deserialize_value_internal (s=0x7fffdcc0) at dump.c:937 #139 0x76e23881 in jl_deserialize_value (s=0x7fffdcc0) at dump.c:950 #140 jl_restore_system_image (fname=optimized out) at dump.c:1060 #141 0x76e1f33b in julia_init ( imageFile=0x608e60 /home/dluu/dev/julia/usr/bin/../lib/julia/sys.ji) at init.c:826 #142 0x0040140a in main (argc=0, argv=0x7fffe1c0) at repl.c:378 On Sun, Aug 31, 2014 at 8:39 AM, Andrea Vigliotti andrea.viglio...@gmail.com wrote: Hi all! I am having problems in updating Julia from the git. As usual, every three four days I download the last updates from the git and compile them, this is what I do (I'm running ubuntu with KDE, and Julia is v0.4) from the source directory I typed git pull make then I got this ... ... ... iterator.jl inference.jl ERROR: LoadError(/usr/local/julia/v0.4/base/sysimg.jl,65,LoadError(inference.jl,134,UndefVarError(:sizeof))) in include at ./boot.jl:245 (repeats 2 times) in include_from_node1 at loading.jl:128 in process_options at ./client.jl:285 in _start at ./client.jl:354 in _start_3B_13569 at /usr/local/julia/v0.4/usr/lib/julia/sys.so *** This error is usually fixed by running 'make clean'. If the error persists, try 'make cleanall'. *** make[1]: *** [/usr/local/julia/v0.4/usr/lib/julia/sys.o] Error 1 make: *** [release] Error 2 after doing the make cleanall, tried make again and got ... ... ... /usr/bin/install -c -m 644 '_U_dyn_register.man' '/usr/local/julia/v0.4/usr/share/man/man3/_U_dyn_register.3' /usr/bin/install -c -m 644 '_U_dyn_cancel.man' '/usr/local/julia/v0.4/usr/share/man/man3/_U_dyn_cancel.3' /usr/bin/install -c -m 644 include/libunwind-dynamic.h include/libunwind-ptrace.h include/libunwind-coredump.h include/libunwind-x86_64.h include/libunwind.h include/unwind.h '/usr/local/julia/v0.4/usr/include' /usr/bin/install -c -m 644 include/libunwind-common.h '/usr/local/julia/v0.4/usr/include' Makefile:141: /Makefile.rules: No such file or directory make[3]: *** No rule to make target `/Makefile.rules'. Stop. make[2]: *** [/usr/local/julia/v0.4/usr/lib/libLLVMJIT.a] Error 2 make[1]: *** [julia-release] Error 2 make: *** [release] Error 2 now I'm stucked, I looked on the internet but could find reason or solutions for this, it happened before and I had to remove everything and download and make everything from scratch, does anybody know how it is possible to fix this without completely reinstalling Julia?? thanks! andrea
[julia-users] Re: List of useful macros for beginners?
please try @edit eg: @edit print It should be added in recently(0.3.0 does not have this maro) And I think it is a awesome maro! Xiaowei Zhang於 2014年8月31日星期日UTC+8下午9時47分35秒寫道: For example, the Julia manual illustrates the usage of @inbound and @simd as performance tips. Can anyone provide a short list of macros with examples besides these two?
[julia-users] Macros for mixing things like max and sum
I want to do a calculation like this $\max_{a \in A} \sum_{s \in S} g(s, a)$. Of course, I can do something like this: maximum([sum([g(s, a) for s in S]) for a in A]) But it seems like it would be nicer to have the s in S and a in A go in front like in the written equation. I'd like something like this: @max (a in A) @sum (s in S) g(s, a) So, I tried writing these macros: macro max(range, ex) eval(:(maximum($(Expr(:typed_comprehension, :Float64, ex, range) end macro sum(range, ex) eval(:(sum($(Expr(:typed_comprehension, :Float64, ex, range) end To test this, I tried: A = 1:10 S = 1:10 g(s, a) = s*a @max (a in A) @sum (s in S) g(s, a) I get this error: `convert` has no method matching convert(::Type{Float64}, ::StepRange{Int64,Int64}) However, @max (a in A) @sum (s in S) g(s, 1) works just fine. My macro doesn't seem to like having the a in the sum expression. Any tips would be appreciated!